关于this指向
如图:
this基本指向
普通函数调用,此时 this 指向 window
构造函数调用, 此时 this 指向 实例对象
对象方法调用, 此时 this 指向 该方法所属的对象
箭头函数调用, 此时 this 指向 包裹箭头函数的第一个普通函数
改变this指向
bind()
call()
apply()
如图:
普通函数调用,此时 this 指向 window
构造函数调用, 此时 this 指向 实例对象
对象方法调用, 此时 this 指向 该方法所属的对象
箭头函数调用, 此时 this 指向 包裹箭头函数的第一个普通函数
bind()
call()
apply()