[thelist] Using for loops with a twist

Christian Heilmann codepo8 at gmail.com
Tue Apr 3 05:36:16 CDT 2007


> > But here comes the catch: While this is true with real JS arrays try
> > it with a DOM nodelist and you will see that there is no speed
> > difference between "my" method and the backward looping or two
> > variable versions.
>
> Ah, that's interesting, I guess perhaps there's something about DOM
> nodelists that makes calculating the length of them more expensive...

Comparison:
http://icant.co.uk/sandbox/forloops.html

-- 
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