I create an Object in JavaScript:
var object = {value1 : "value1", value2 : "value2"};
If I now try and count the contents of 'object.prototype' I get the result 0. If I add properties I get the correct result. Am I to take it then that 'object.prototype' is in fact empty?
Thanks!
object.prototypeisundefined, and you can't count contents ofundefined. There is anobject.constructor(which in Chrome isfunction Object() { [native code] }, and you can checkObject.prototype). - nnnnnnobject.prototype,object.constructorandObject.prototype. Note that you can add properties toObject.prototype, but you shouldn't do so. - nnnnnn__proto__in every object .. but its not a valid part of JavaScript, some browsers still has this property. for checking working of this try this .Object.prototype.a = 'value a in native Object' ;and printobject.__proto__.a. this link has more info sporto.github.io/blog/2013/02/22/… - rab