Here is the code for forEach, implemented into browsers that do not
implement it themselves:
forEach: function(fn, bind){
for (var i = 0, l = this.length; i < l; i++) fn.call(bind, this[i], i,
this);
}
as you can see, it loops over each item and calls your function, passing the
array's value at i. This is undefined for your zero value. I don't know
where IE would freak out on this (though it doesn't surprise me that it
might). The code above references yourArray[index] that shouldn't throw an
error...
Aaron
On Mon, Dec 14, 2009 at 12:31 PM, Roman Land <[email protected]> wrote:
> Lolz on the kindly:)
>
> Paul, this site is meant to work on all browsers, I currently have a
> work around, this behavior is undesired despite it's roots being in ie
> implementation of foreach.
>
> Cheers, Roman
>
> On 14/12/2009, at 18:28, Paul Saukas <[email protected]> wrote:
>
>
> > Roman ,
> >
> > I believe that is an IE issue . I have no problem running your
> > example on IE8 . It just kindly spits undefined out in place of the
> > missing element 0 if i have it display the items, If i do the keys
> > then IE shows 01234 and ff 1234. What version of IE are you using ?
>