I should add that I probably wouldn't have gotten this right either. In
fact, I was there at the time when the "index" argument was added to .each()
and I didn't notice the problem myself - and I'd never heard of the new
native [].forEach() yet.

But I do have 20/20 hindsight! ;-)

-Mke

> From: Michael Geary
> 
> Actually, the original order chosen for the arguments to the 
> $(...).each() and $.each() callbacks was unfortunate. 
> callback(index,element) is backwards. It's rare that you need 
> the array index; what you want in almost every situation is 
> the array *element*.

Reply via email to