箭头函数虽然方便但也不是每个地方都适用,
箭头函数在开发中可以十分方便的干预 this的指向,在一些情况下,是不需要对this的指向进行干预的,也就不适用箭头函数
1.构造函数的原型方法上
例如:Person.prototype.getFirst = function(){}
2.需要获取 arguments
箭头函数中不具备 arguments 伪数组
3.使用对象的方法
const Person = {
getName:function(){}
}
4.使用动态回调时
例如 addEventListener 绑定的方法,如果使用箭头函数 this就会指向window