Arrow Functions Cannot Be Constructors
What you'll learn: Why arrow functions can't be used with the new keyword to create object instances.
The Missing Prototype
Arrow functions have a fundamentally different design than regular functions. They don't have their own prototype property, which means they cannot serve as constructors for object instances.
When you use the new keyword with a function, JavaScript does several things behind the scenes:
- Creates a new empty object
- Sets that object's prototype using the constructor's
.prototypeproperty - Binds
thisto that new object - Returns the new object
Arrow functions fail at step 2 and 3—they have no prototype to link to, and they don't bind this dynamically. They inherit this lexically from their surrounding context instead.
What This Means in Practice
// Regular function as constructor - WORKS
function Person(name) {
this.name = name;
}
const john = new Person('John');
console.log(john.name); // 'John'
// Arrow function as constructor - ERROR
const Animal = (type) => {
this.type = type;
};
const dog = new Animal('Dog'); // TypeError: Animal is not a constructor
You can verify this by checking for the prototype:
function regularFunc() {}
const arrowFunc = () => {};
console.log(regularFunc.prototype); // {}
console.log(arrowFunc.prototype); // undefined
No prototype means no constructor behavior. JavaScript will throw a TypeError if you try to use new with an arrow function.
Key Takeaway: Arrow functions are lightweight and designed for callbacks, not object construction—they have no prototype property and cannot be called with new.