var oldobj = {
firstm: function () { console.log("firstm"); },
secondm: function () { console.log("secondm"); }
};
var newobj= Object(oldobj);
newobj.thirdm = function () { console.log("thirdm"); };
oldobj.fourthm = function () { console.log("4thm"); };
newobj.fifthm = function () { console.log("5thm"); };
oldobj.fifthm(); // logs "5thm" in console
According to prototypical inheritance, the oldobj has no link to newobj functions. But in the above example how is the oldobj able to access fifthm() of newobj?
Object()withObject.create()?