๐Ÿ”ฐIIFE

Immediately-Invoked Function Expression

JS โŸฉ concepts โŸฉ expression โŸฉ function expression โŸฉ IIFE

immediately-invoked function expression

a closure (or IIFE) can be used to create a scope to hide variables/functions.

break/continue won't operate across an IIFE function boundary to control an outer loop/block.

๐Ÿ“— You Don't Know JS Yet: Scopes & Closrues

if the code you need to wrap a scope around has return, this, break, or continue in it, don't use a function/IIFE(which has its own function boundary), use a block insteadโ—๏ธ

๐Ÿ“— You Don't Know JS Yet: Scopes & Closrues

Last updated