2 ms·
> And here you could argue that the other coder should've known to use hasOwnProperty or forEach or whatever, but, all that aside... I don't think you can dism
by lowboy 13y ago
> And here you could argue that the other coder should've known to use hasOwnProperty or forEach or whatever, but, all that aside...
I don't think you can dismiss that argument so easily. Other people modifying natives is the reason that if you're unsure of your environment, you shouldn't rely on `for(el in array/object)` without appropriate `hasOwnProperty` checks.
If you have control over your environment and the developers who will work in/with it (ex. the code for your website vs an npm module you plan to publish), then I see nothing wrong with naked `for (el in array/object)` or with extending natives if it's worth the added cost of developer overhead (they have to know that they're working with extended natives).