function d(){this.get=function(){this.getNum()}};
d.prototype.getName=function(){return 3;} ;
var d = new d();
console.log(d.get());//undefined
Why is undefined shown here? Instead of 3? Please answer
怪我咯2017-05-19 10:48:15
function d(){this.get=function(){return this.getName()}};
d.prototype.getName=function(){return 3;};
var d = new d();
console.log(d.get());//undefined
某草草2017-05-19 10:48:15
function d(){this.get=function(){return this.getName();}};
d.prototype.getName=function(){return 3;};
var d = new d();
console.log(d.get());
Compare for yourself
我想大声告诉你2017-05-19 10:48:15
function d(){
this.get= function(){
return this.getName()
}
};
d.prototype.getName = function(){
return 3;
};
var d = new d();
console.log(d.get());