[thelist] Using for loops with a twist

Lee Kowalkowski lee.kowalkowski at googlemail.com
Tue Apr 3 03:17:52 CDT 2007


On 03/04/07, Christian Heilmann <codepo8 at gmail.com> wrote:
> As the length can change, for example when you manipulate the DOM
> whilst looping through a nodelist (see the last example).

I tend to loop backwards on such occasions.

for(var i = arr.length - 1; i >= 0; i--)

-- 
Lee



More information about the thelist mailing list