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.基本用法 ES6允许使用“箭头”(=>)定义函数。 var f = v =>v ; 上面的箭头函数等同于: var f = function ( v ) { return v ; }
var f = v =>v ;
var f = function ( v ) { return v ; }
The text was updated successfully, but these errors were encountered:
尤其注意this的指向: this指向的固定化:函数体内的this对象就是定义时所在的对象,而不是使用时所在的对象。 this指向的固定化的原因:箭头函数根本没有自己的this,导致内部的this就是外层代码块的this。 正因为它没有this,所以也就不能用作构造函数。当然也就不能用call()、applay()、bind()这些方法去改变this的指向,使用这些方法都是无效的。
Sorry, something went wrong.
No branches or pull requests
1.基本用法
ES6允许使用“箭头”(=>)定义函数。
var f = v =>v ;
上面的箭头函数等同于:
var f = function ( v ) { return v ; }
The text was updated successfully, but these errors were encountered: