参与共建
语言
框架 & 库
其他
模式
new
箭头函数
如果 new 一个箭头函数,会抛出一个 TypeError 异常,因为箭头函数没有 prototype 属性,也没有 [[Construct]] 内部方法,不能作为构造函数使用。
TypeError
prototype
[[Construct]]
🌰:
const Foo = () => {}; const foo = new Foo(); // TypeError: Foo is not a constructor
箭头函数与普通函数的区别