var name = "The Window";
var object = {
name : "My Object",
getNameFunc : function(){
return function(){
return this.name;
};
}
};
alert(object.getNameFunc()());这一段返回的为什么是 The Window,子函数找变量不是一级一级网上找吗,找的不应该是My Object吗?
var name = "The Window";
var object = {
name : "My Object",
getNameFunc : function(){
var that = this;
return function(){
return that.name;
};
}
};
alert(object.getNameFunc()());返回的是My Object,这里面的var that = this改变了指向吗,这里的That是哪个对象?
素胚勾勒不出你
GCT1015
RISEBY
随时随地看视频慕课网APP
相关分类