I am a student studying programming.
I have a question.
function a () {
}
a.prototype.prtSomething = function(arg) { console.log(arg); }
function b () {
}
var myObj = new b();
If I want to use the method of a in myObj, we use this code.
b.prototype = Object.create(a.prototype);
b.prototype.constructor = b;
That means changing the target of scope chaining. But why don't we use this code?
b.prototype.__proto__ = a.prototype;
I think there must be a reason to creating and using a new object. but I don't know. Please teach me. Thank you.