3 ms·
You should NOT use any library that messes with Object.prototype or Array.prototype, then this won't be a problem and the for loops will work just fine.
by paul 19y ago
You should NOT use any library that messes with Object.prototype or Array.prototype, then this won't be a problem and the for loops will work just fine.
- axod 19y agoNot particularly, if you're extending your own objects, you could still get properties in a for...in that you weren't expecting, so hasOwnProperty is always a good idea. Regardless though, using for...in on an Array is bad practice and not a good idea. Just like having sparse Arrays in js is a bad idea.