Immediately invoked function expression: Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Add: date, authors 1-1. Removed parameters. Some additions/deletions were parameter name changes. | Use this bot. Report bugs. | Suggested by Superegz | Category:Programming language concepts‎ | #UCB_Category 12/23
Replacing usurped ref with cite web template + usurped tag
Line 47:
 
==Examples==
The key to understanding design patterns such as IIFE is to realize that prior to ES6, JavaScript only featured [[Scope (computer science)#Function scope|function scope]] (thus lacking [[Scope (computer science)#Block scope|block scope]]), passing [[Call_by_reference|values by reference]] inside [[Closure (computer science)|closure]]s.<ref>{{cite book |last=Haverbeke |first=Marijn |title=Eloquent JavaScript |year=2011 |publisher=No Starch Press |isbn=978-1-59327-282-1 |pages=29–30}}</ref> This is no longer the case, as the ES6 version of JavaScript implements block scoping using the new <code>let</code> and <code>const</code> keywords.<ref>{{cite web |url=https://es6-features.org/#BlockScopedVariables |title=ECMAScript 6: New Features: Overview &and Comparison - Block-Scoped Variables |website=es6-features.org |access-date=March 19, [http2018 |archive-date=March 18, 2018 |archive-url=https://web.archive.org/web/20180318064130/https://es6-features.org/#BlockScopedVariables Block|url-Scopedstatus=usurped Variables]}}</ref>
 
=== Evaluation context ===