News for hackers. Stuff that matters.
Re:Google Closure: How not to write Javascript by tlrobinson on Thursday November 12, 2009 @04:02AM (#937408)
If you want to super careful, obj.hasOwnProperty(key) is actually dangerous. What happens when obj has it's own property named "hasOwnProperty"?

The safest thing to do is:

    Object.prototype.hasOwnProperty(obj, key)
Of course, as with the "undefined" example, malicious or incompetent code could overwrite Object.prototype.hasOwnProperty

There are no comments on this comment yet.