I want to extend Object.prototype, to basically support notifications in JSON data and html elements through UI framework.
Object.prototype.setValue = functi
I know it fails
for(var x in obj), but mostly we can useobj.hasOwnProperty, that should help right?
That is the only major pitfall, and .hasOwnProperty() helps, but only in your own code. In jQuery, for example, they've taken the deliberate decision not to call .hasOwnProperty in the $.each() method.
I have used Object.defineProperty(...) in my own code to get around the enumerable property problem with no ill-effects (albeit on Array.prototype)