var title = "aaa";
var myclass = function(){}
myclass.title = "bbb";
myclass.prototype.getTitle = function(){
function doGetTitle(){
return this.title;
}
return doGetTitle.call(this);
}
var obj = new myclass();
console.log(obj.getTitle());
console为什么输出undefined呢?我以为是‘aaa’,我的理解是闭包内部函数里的this指向全局的widow
相关分类