DOM 绑定的事件中调用 this 来获取自身的某个属性值
document.querySelector('#textBtn').oninput = () => { console.log(this.value); // undefined };通过 call、apply、bind 来改变 箭头函数的 this
// apply const A = (age, gender) => { this.age = age; this.gender = gender; }; const a = {}; A.apply(a, [18, 'gender']); console.log(a); // {} // bind const test = () => { console.log(this.gender); // window.gender => undefined }; const obj = { gender: 'male', }; const bindTest = test.bind(obj); bindTest();把箭头函数当做构造函数
const A = () => {}; const a = new A(); // 报错在构造函数中使用 arguments 对象
const a = () => { console.log(arguments); // arguments 未定义 };把箭头当做 generator 函数使用
const a = *() => {}; // 编译器就语法错误了