Eloquent Javascript: Can't understand how the number value is determined in the sum function
<p>I am trying to understand how the <strong>number</strong> variable is determined based on example from the book <em>Eloquent Javascript</em>.</p>

<p>When I output <strong>number</strong> I can see it growing as the loop progresses, but i can't see where the number variable is actually set.</p>

<p>(Note: For anybody who understands Eloquent Javascript I have changed over the show() function to alert())</p>

<pre><code>function forEach(array, action) {
  for (var i = 0; i &lt; array.length; i++)
    action(array[i]);
}

function sum(numbers) {
  var total = 0;
  forEach(numbers, function (number) {
    total += number;
  });
  return total;
}
alert(sum([1, 10, 100, 1000]));
</code></pre>
