调用方法 | function函数 | 箭头函数 |
---|---|---|
普通函数 | this 指向 window 对象 |
this 指向 window 对象 |
函数作为对象的方法 | this 指向调用方法的对象 |
this 指向 window 对象 |
构造函数 | this 指向 new 创建出的对象 |
箭头函数不能作为构造函数 |
bind, apply, call | this 指向新绑定的对象 |
this 保持原先的指向 (箭头函数的this指向是固定的) |
javascript 浏览器的this指向
猜你喜欢
转载自blog.csdn.net/SJ1551/article/details/109294801
今日推荐
周排行