Javascript for loop efficiency

Posted by Misha Moroshko on Stack Overflow See other posts from Stack Overflow or by Misha Moroshko
Published on 2010-04-30T05:08:44Z Indexed on 2010/04/30 5:17 UTC
Read the original article Hit count: 161

Filed under:

Is

for (var i=0, cols=columns.length; i<cols; i++) { ... }

more efficient than

for (var i=0; i<columns.length; i++) { ... }

?

In the second variant, is columns.length calculated each time the condition i<columns.length is checked ?

© Stack Overflow or respective owner

Related posts about JavaScript