var data = [];
for (i = 0, len = data.length; i < len; i++) {
for (i = 0, i < data.length; i++) {
What is the difference between these two way of forming an loop and which is sited as best among them.
Calling the first one is cheaper than the second one. Is it true?
Yes, it is – according to:
http://blogs.oracle.com/greimer/entry/best_way_to_code_a
Note: you could easily build a test if you are not convinced.