object oriented javascript with prototypes
<p>I'm trying to understand this a bit more clearly.  When I extend modify the each function inside the Array prototype, How does calling func(this[i]) call the function passed into Array.each.  </p>

<p>Since the function definition is function(func) and func is the parameter.  </p>

<p>Does func = <code>function(i) { alert(i) }</code> and thus <code>func(this[i]) = { function(this[i]) { alert(this[i]) }</code> ?</p>

<pre><code>Array.prototype.each = function(func) {
  for (var i=0; i&lt;this.length; i++) {
    func(this[i]);
  }
};

[1,2,3].each(function(i) {
  alert(i);
});
</code></pre>
