My expectation from the following code would be that if I checked a.name
, it would search the prototype and return it as it was declared. Can anyone pinpoint what it is that is preventing JS from acknowledging my prototype?
var obj = function(parent){
return {
prototype: parent
}
};
var me = { name: 'keith' };
var a = new obj(me)
// => undefined
a.name
// => undefined
a.prototype.name
// => "keith"