Immediately invoked function expression: Difference between revisions

Content deleted Content added
reword intro. the idiom is notable for being used in Javascript, but it's not a Javascript-only idiom. Also it's basically dead because modules got added to ES6
Evaluation context: Removed reference to Herman book example. Unless the reader has access to Herman's book or the example from the book, I don't see how the fact that Herman has an example is helpful to the article.
Line 83:
getValue(); // 1
</syntaxhighlight>
 
David Herman's ''Effective JavaScript'' contains an example illustrating the problems of evaluation context inside loops.<ref>{{cite book |last=Herman |first=David |title=Effective Javascript |year=2012 |publisher=Addison-Wesley |isbn=978-0-321-81218-6 |pages=44–45}}</ref> While Herman's example is deliberately convoluted, it arises directly from the same lack of block scope.<ref>{{cite book |last=Zakas |first=Nicholas C. |title=Professional JavaScript for Web Developers |chapter=Mimicking Block Scope |year=2011 |publisher=John Wiley & Sons |isbn=978-1-118-23309-2}}</ref>
 
=== Establishing private variables and accessors ===