- 没有this
- 无法new
- 不能使用arguments
- 不能使用yield
不适合使用箭头函数的地方
const cat = {
lives: 9,
jumps: () => {
this.lives--;
}
}
var button = document.getElementById('press');
button.addEventListener('click', () => {
this.classList.toggle('on');
});
// 本意是this为调用者,但是箭头函数会把变成静态,this已经绑定在了window上