I'm confused why can't I take follwing code correctly make sense
function Parent(){
this.foo = 'bar';
}
function Son(){}
// if I do this
Son.prototype = Parent.prototype;
new Son().foo;
// output undefined
// try normal way
Son.prototype = new Parent();
new Son().foo;
// output 'bar'
In my opinion, instance son
find its prototype via __proto__
, maybe like a pointer, but why can't I directly refer to Parent.prototype
?