I have just installed Aptana Studio for development and one of the available commands for Javascript is Insert a for loop like this:
for (var i=0; i < Things.length; i++) {
Things[i]
};
Another option is Insert improved for loop like this:
for (var i = Things.length - 1; i >= 0; i--){
Things[i]
};
Why this last one is better than the first one?
Best Answer
Things
on every single iteration.)That said, the performance you get from changing the loop is minimal, and you risk sacrificing part of the readability, so stick with what you find most readable - not what is most correct performance-wise.
This might make more sense for you:
could be rewritten as the following:
and
could be rewritten as the following: