为什么说加上B.prototype.constructor= B;就无法回溯原型链啊? 不是明明可以取到值么
function A (){
}
A.prototype = {
name:4
}
function B (){
}
B.prototype = new A();
B.prototype.constructor= B;
var b = new B();
结果:4
为什么说加上B.prototype.constructor= B;就无法回溯原型链啊? 不是明明可以取到值么
function A (){
}
A.prototype = {
name:4
}
function B (){
}
B.prototype = new A();
B.prototype.constructor= B;
var b = new B();
结果:4