News for hackers. Stuff that matters.
Re:Why perl has separate arrays and hashes: It's as if they ... by __david__ on Tuesday June 21, 2011 @01:59PM (#2679719)
> Friends don't let friends iterate over arrays with for...in.

Which is too bad because it looks so much better.

Re:Why perl has separate arrays and hashes: It's as if they ... by masklinn on Tuesday June 21, 2011 @02:12PM (#2679775)
I just use Array.prototype.[forEach|map|filter] instead, or the equivalent Underscore.js function (which aliases to native when it can) if IE-compatibility is needed.

If you need performances, nothing will beat C-style access anyway. And FWIW, using for...in on an array is slower than using Array.prototype.forEach.

edit: FWIW, even hand-rolling an each() function (in the style of underscore's) will be faster than for...in.