var name="Liny";
console.log("全局中this指向", this.name);
var o = {
name: "tom",
say:function(){
console.log("对象中this指向", this.name);
}
}
o.say();
var f = {
name: "tina",
say:function(){
var that = this;
return function(){
console.log("对象中匿名函数this指向", that.name)
}
}
}
f.say()();
改变匿名函数之中this的作用域
最新推荐文章于 2021-12-03 22:41:18 发布