function d(){this.get=function(){this.getNum()}};
d.prototype.getName=function(){return 3;};
var d = new d();
console.log(d.get());//undefined
为什么这里显示undefined?而不是3?求解答
function d(){this.get=function(){this.getNum()}};
d.prototype.getName=function(){return 3;};
var d = new d();
console.log(d.get());//undefined
为什么这里显示undefined?而不是3?求解答
function d(){this.get=function(){return this.getName();}};
d.prototype.getName=function(){return 3;};
var d = new d();
console.log(d.get());
自己对比下
function d(){
this.get= function(){
return this.getName()
}
};
d.prototype.getName = function(){
return 3;
};
var d = new d();
console.log(d.get());
5 回答9.3k 阅读✓ 已解决
9 回答2.5k 阅读✓ 已解决
14 回答3.5k 阅读
4 回答1.3k 阅读✓ 已解决
6 回答1.2k 阅读✓ 已解决
6 回答1.7k 阅读✓ 已解决
12 回答5.4k 阅读