[thelist] Using for loops with a twist

Christian Heilmann codepo8 at gmail.com
Tue Apr 3 02:40:01 CDT 2007


On 4/3/07, Jason Handby <jason.handby at corestar.co.uk> wrote:
> > In case you didn't know: The condition part of a JavaScript for loop
> > can be any condition, it does not need to compare the iterator. This
> > allows you for example to loop through an array without reading the
> > length:
>
> Why would you want to loop through an array without reading the length?

As the length can change, for example when you manipulate the DOM
whilst looping through a nodelist (see the last example).



-- 
Chris Heilmann
Book: http://www.beginningjavascript.com
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/



More information about the thelist mailing list