function d(){this.get=function(){this.getNum()}};d.prototype.getName=function(){return 3;};var d = new d();console.log(d.get());//undefined
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.getNum()}};
你说呢
function d(){this.get=function(){return this.getName();}}; d.prototype.getName=function(){return 3;}; var d = new d(); console.log(d.get());
自己对比下
名字
this.getnum改成this.getname
雷雷
你说呢
自己对比下
名字
this.getnum改成this.getname
雷雷