We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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)箭头函数语法上比普通函数更加简洁
(2)箭头函数没有自己的this,它里面出现this是继承函数所处上下文中的this(使用call,apply等任何方式都无法改变this的指向)
(3)箭头函数中没有arguments(类数组),只能基于…ARG获取传递的参数集合
(4)箭头函数不能被new函数(因为:箭头函数没有this,也没有prototype)
注:回调函数的this一般指向window
function Person(){ (()=> {console.log(this)})(); } Person(); //window new Person();//Person{}
讨论见:#50
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
箭头函数和普通函数的区别
(1)箭头函数语法上比普通函数更加简洁
(2)箭头函数没有自己的this,它里面出现this是继承函数所处上下文中的this(使用call,apply等任何方式都无法改变this的指向)
(3)箭头函数中没有arguments(类数组),只能基于…ARG获取传递的参数集合
(4)箭头函数不能被new函数(因为:箭头函数没有this,也没有prototype)
注:回调函数的this一般指向window
讨论见:#50
The text was updated successfully, but these errors were encountered: