This MDN page claims:
...you can iterate over an array using the following:
for (var i = 0; i < a.length; i++) { // Do something with a[i] }
This is slightly inefficient as you are looking up the length property once every loop. An improvement is this:
for (var i = 0, len = a.length; i < len; i++) { // Do something with a[i] }
A nicer-looking but limited idiom is:
for (var i = 0, item; item = a[i++];) { // Do something with item }
Are these really commonly accepted ways of iteration? Wouldn't modern JavaScript engines simply optimize the first one?