最近学习闭包时,对下面这段代码最后弹出 The Window 不是很明白,哪位高手详细指引下呗?
var name = "The Window";
var object = {
name : "My Object",
getNameFunc : function(){
return function(){
return this.name;
};
}
};
alert(object.getNameFunc()());
...全文
693打赏收藏
跪求高手帮帮忙
最近学习闭包时,对下面这段代码最后弹出 The Window 不是很明白,哪位高手详细指引下呗? var name = "The Window"; var object = { name : "My Object", getNameFunc : function(){ return function(){ return this.name; }; } }; alert(object.getNameFunc()());