DEV Community

Discussion on: IIFE's (Immediately-Invoked Function Expressions) in JavaScript Explained in 3 Minutes

Collapse
 
wrldwzrd89 profile image
Eric Ahnell

Oh really? I have assigned script-level variables the initial value of undefined with the intent of initializing them fully inside a later function call, in strict mode, which works just fine. To minimize the opportunity for conflicts, any function-scope variables use one of the ES5 keywords for this purpose in their declarations. Combined with a linter enforcing the rules, I make it as easy as possible to avoid trouble and detect the cause if it happens anyway.