What Object.create does is that :
Object.create = function ( p ) {
function Constructor( ){}
Constructor.prototype = p;
return new Constructor( );
};
Therefore,
obCopy.hasOwnProperty( 'prop' );// false
But as obCopy has no prop property, it searches in the prototype of his
constructor : obCopy.constructor.prototype.prop and as long as it doesn't
find, it continues going up the prototype chain until he gets to Object from
which all inherit and if it doesn't find the property in Object it returns
undefined;
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]