Re:Understanding JavaScript Arrays
by svnv on Saturday July 24, 2010 @03:19PM
(#1544223)
Isn't this faster for iterating over the elements:
[ Parent
| on HN ]
Actually, I just realized this does not work, there is an off by 1 error here. jacksoncarter's piece of code works though.
Re:Understanding JavaScript Arrays
by jacksoncarter on Saturday July 24, 2010 @09:18PM
(#1544739)
Or try this
var i = a.length;
while (i--){
console.log(a[i]);
}Clever, but sometimes you don't want to go in reverse.