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
这篇文章主要用于知识点扫盲,箭头函数与普通函数的区别,盲点如下:
new.target是ES6新引入的属性,普通函数如果通过new调用,new.target会返回该函数的引用。
此属性用于确定构造函数是否为 new 调用的;
let a = () => { console.log(new.target); // 报错:new.target 不允许在这里使用 }; a();
new bb(); function bb() { let a = () => { console.log(new.target); // 指向函数bb:function bb(){...} }; a(); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
《详解箭头函数和普通函数的区别》
这篇文章主要用于知识点扫盲,箭头函数与普通函数的区别,盲点如下:
1. 箭头函数不存在 prototype,也就没有 this 的概念;
2. 箭头函数没有 constructor 构造函数,因此不能使用 new 关键字;
3. 箭头函数的 this 指向普通函数时,其 argument 继承与该普通函数;
4. 箭头函数的 this 指向全局时,使用 argument 时会报错;
5. 箭头函数不支持 new.target
此属性用于确定构造函数是否为 new 调用的;
The text was updated successfully, but these errors were encountered: