Contact

Send a message to Tino Zijdel in reply to the comment:

I'm not surprised having done these tests myself already years ago. From a practical point of view I usually use the while (n--) loop (when order doesn't matter):

var ar = [1,2,3], n = ar.length;
while (n--) alert(ar[n]);

opposite to this because of obvious reasons:

var ar = [1,2,3], n = ar.length;
while (--n) alert(ar[n]);
// problem is, we now miss ar[0];

but when you are iterating arrays (which is the common reason to use these kind of loops) this seems to be faster still, just as long as you are sure none of the array-values will evaluate to false:

var ar = [1,2,3], n = 0, el;
while ((el = ar[n++])) alert(el);

Of Interest

Hangouts

Listening