We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// 1.定义对象内的函数 var lives = 1 const cat = { lives: 9, jumps: () => { this.lives--; } } console.log(cat.jumps()) // 输出结果:1 // 2. 需要动态this var button = document.getElementById('press'); button.addEventListener('click', () => { this.classList.toggle('on'); }) // 点击button后报错,因为this指向windows,没有toggle属性
ECMAScript 6 入门 - 阮一峰
The text was updated successfully, but these errors were encountered:
sihai00
No branches or pull requests
区别
不适用的场景
参考
ECMAScript 6 入门 - 阮一峰
The text was updated successfully, but these errors were encountered: