When creating a new object, you are able to reference any member of the object class. For example:
var obj = new Object();
obj["watch"]; //returns the watch() function of Object
Is there a way to override this default behavior so that obj[“watch”] returns undefined instead? Note that I only see this behavior in Firefox
Since EcmaScript 5.1, you can generate objects without a prototype (and without
Object.protoype) this way:You will need the native function, the simple polyfill that utilizes
newis not capable of doing this. See also this docs section of es5-shim.That’s because
watchis a non-standard FF extension. You should be able to obtain the standard properties in other browsers as well, though.