DEV Community

Discussion on: Arrow Function vs Function

Collapse
sshymko profile image
Sergii Shymko Author

Arrow functions cannot be used as class constructors, for instance:

const Class1 = function () {};
const Class2 = () => {};

let obj1 = new Class1();  // Ok
let obj2 = new Class2();  // TypeError: Class2 is not a constructor
Enter fullscreen mode Exit fullscreen mode
Collapse
piyush1104 profile image
Piyush Bansal

Cool, this is something new I didn't know.