Wednesday, May 11, 2016

primitive_and_prototype_chain

var i = 10
Object.prototype.foo = 'Foo';
alert( i.foo ) //Foo

i.bar = 'Bar' // No effect: primitive is not extensive in own props
alert( i.bar )// undefined

alert( i.constructor ) // function Number(){}
alert( typeof i.constructor.prototype ) //object

No comments:

Post a Comment