1、匿名函数中 this一般指向window对象
2、闭包函数中的this,指向window
文章地址https://www.yii666.com/article/764192.htmlvar mod = {
init: function(){
console.log('this',this);
var aa = function(){
console.log('匿名函数中this',this);
}
aa(); //相对于自执行函数
function bb(){
console.log('闭包函数中的this',this); }
bb();
}
}
mod.init();
运行结果如下:
网址:yii666.com文章来源地址:https://www.yii666.com/article/764192.html