lexical scoping in javascript
<p>I'm reading this book: <a href="http://eloquentjavascript.net/" rel="nofollow">http://eloquentjavascript.net/</a> which I think is brilliant.</p>

<p>However I'm having difficulty understanding the following function, where does the function add(number) get its argument from?</p>

<pre><code>function makeAddFunction(amount) {
  function add(number) {
    return number + amount;
  }
  return add;
}

var addTwo = makeAddFunction(2);
var addFive = makeAddFunction(5);
show(addTwo(1) + addFive(1));  // gives 9
</code></pre>

<p>I thought the answer would be 7 to this <code>show(addTwo(1) + addFive(1));</code></p>

<p>In <code>makeAddFunction(2)</code>, amount is 2, but what would number be? so number + 2...</p>

<p>NB: show function is pretty much echo in php.</p>
