The key to understanding design patterns such as immediately-invoked function expressions is to realize that until recently JavaScript hashad only [[Scope (computer science)#Function scope|function scope]] (but not [[Scope (computer science)#Block scope|block scope]]) and passes values by reference inside a [[Closure (computer science)|closure]].<ref>{{cite book|last=Haverbeke|first=Marijn|title=Eloquent JavaScript|year=2011|publisher=No Starch Press|isbn=9781593272821|pages=29–30}}</ref> (This is no longer entirely true, in the latest version of JavaScript block scoping does exist thanks to the new <code>let</code> keyword.<ref>ECMAScript 6 — New Features: Overview & Comparison, [http://es6-features.org/#BlockScopedVariables Block-Scoped Variables].</ref>)