See the code segment below:
var o = {f:function(){ return this.a + this.b; }};
var p = Object.create(o);
o.a = 10;
o.b = 20;
console.log(o.f());
console.log(p.f());
The p object does not have the properties pa and pb, then how pf () returns the result 30. Is this prototype chain? Can anyone explain this? Thank you in advance.
source
share