by Cardinal · 15y ago · 0 comments
var man = fromPrototype(person, { sex: "male" });
After this code runs, we have a reference to a function (man) inside which we declare an object (newObject) for which we define the new property (sex). That means we can now call newObject.sex
But later he's calling that property on the function itself : jeremy.sex
How is this possible?
return newObject;
'man' and 'jeremy' are objects, not functions.