var name = "The Window";
var object = {
name : "My Object",
getNameFunc : function(){
return function(){
alert(this);
return this.name;
};
}
};
alert(object.getNameFunc()());//输出The Window
var name1 = "The Window";
var object1 = {
name : "My Object",
getNameFunc : function(){
alert(this);
var that = this;
return function(){
return that.name;
};
}
};
alert(object1.getNameFunc()());//输出My Object
上面的this为window对象,而下面的this为什么是object1对象,求当中的详细讲解,小子不胜感激