You are viewing a single comment's thread from:
RE: JavaScript - hasOwnProperty in `for-in` loops
Hi @heejin,
Sorry, I'm confused a little:)
If I never change Object.prototype
in my code, should i still check for hasOwnProperty
?
I'll might going to use Object.keys()
as it is really looks simple but first I want to understand if I'm in danger that something changes my Object without I'm asking for it, or not?
Edit: I got it now, "You can easily modify Object.prototype" So it is me, who accidentally changing it! My question was lame:)
Yes and for example, If you write an Web Application, then you may use many libraries as dependencies.
and those libraries could change
Object.prototype
at anytime. So you'd better to use safer way.