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
雷雷