function d(){this.get=function(){this.getNum()}};
d.prototype.getName=function(){return 3;};
var d = new d();
console.log(d.get());//undefined
Warum wird hier undefiniert angezeigt? Statt 3? Bitte antworten Sie
function d(){this.get=function(){return this.getName()}};
d.prototype.getName=function(){return 3;};
var d = new d();
console.log(d.get());//undefined
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());