function ConstructorA(){
this.ten = function(){
return 5+5;
}
}
function ConstructorB(){
this.fifteen = function(){
var ten = ConstructorA.ten();
return 5 + ten;
}
}
答案 0 :(得分:0)
您需要使用 new
Constructor
调用构造函数这样()
:
function ConstructorA(){
this.ten = function(){
return 5+5;
}
}
function ConstructorB(){
this.fifteen = function(){
var ten = new ConstructorA().ten();
return 5 + ten;
}
}
console.log(new ConstructorB().fifteen());