js中的this

参考学习:https://www.cnblogs.com/lisha-better/p/5684844.html
1.普通函数调用(window)
2.作为构造函数调用()
3.作为方法调用
4.使用call/apply/bind调用
5.ES6箭头函数调用(this取决于包裹箭头函数的第一个普通函数)

**setTimeout()由window对象调用
call()参数为空,this指向window
匿名函数,this也指向window
在这里插入图片描述

在事件中,this指向触发这个事件的对象,特殊的是,IE中的attachEvent中的this总是指向全局对象Window

原文地址:https://www.cnblogs.com/princeness/p/11664976.html