3 ms·
That's stupid, the reason you should not use `for... in` isn't because it's slow, it's because it's reflective. It's using reflection over object keys to itera
by inglor 13y ago
That's stupid, the reason you should not use `for... in` isn't because it's slow, it's because it's reflective.
It's using reflection over object keys to iterate an array. This just happens to work because JavaScript arrays are also objects.
`myArr.forEach(function(el){
// do things here
});`
Is perfectly fine.
- inglor 13y agoAlso, http://stackoverflow.com/a/17253577/1348195 http://stackoverflow.com/a/17253577/1348195