ThisCalculator

Everyday

Arrow Function Can’t Be a Constructor: Why

Updated · Standard formula, shown below

Average pace 5.00 min/km
Average speed
12.00 km/h
Result
Finish time
50 min
You entered
Distance
10 km
You entered

Arrow Function Can't Be a Constructor: Why

An arrow function cannot be a constructor because it does not have its own this binding and lacks the internal [[Construct]] method that regular functions have. When you try to use new with an arrow function, JavaScript throws a TypeError because the engine cannot create a new object and bind it as this inside the function.

Formula

Pace (min/km) = Finish time (minutes) ÷ Distance (km)
Speed (km/h) = Distance (km) ÷ (Finish time (minutes) ÷ 60)

Variables:
• t = finish time in minutes
• d = distance in kilometers
• pace = minutes per kilometer
• speed = kilometers per hour

Worked Example

Using the default values: t = 50 minutes, d = 10 km

Pace = 50 ÷ 10 = 5.00 min/km
Speed = 10 ÷ (50 ÷ 60) = 10 ÷ 0.8333 = 12.00 km/h

So a 50-minute, 10 km run gives an average pace of 5:00 per km and an average speed of 12 km/h.

What Does “Constructor� Mean in JavaScript?

In JavaScript, a constructor is a function that you call with the new keyword to create a new object. The new operator does four things:

  • Creates a brand new empty object.
  • Sets the prototype of that object to the function’s prototype property.
  • Binds this inside the function to the new object.
  • Returns the new object (unless the function explicitly returns another object).

For this to work, the function must have a prototype property and an internal [[Construct]] method. Regular functions (declarations, expressions, and methods) have both. Arrow functions have neither.

How Arrow Functions Differ

Arrow functions were introduced in ES6 (ECMAScript 2015) as a concise syntax for writing functions. They differ from regular functions in several key ways:

  • Lexical this: Arrow functions do not have their own this. Instead, they inherit this from the surrounding scope where they are defined.
  • No arguments object: Arrow functions don’t have their own arguments object; they use the one from the enclosing scope.
  • No prototype property: Because they cannot be used as constructors, arrow functions don’t have a prototype property.
  • Cannot be used with new: The JavaScript engine throws a TypeError if you try.

Why the Engine Throws an Error

When you write new arrowFn(), the engine checks whether the function has the internal [[Construct]] method. Regular functions have it; arrow functions do not. The spec (ECMAScript) explicitly says that arrow functions are not constructors. So the engine throws:

TypeError: arrowFn is not a constructor

This is not a runtime quirk—it’s by design. The language authors decided that arrow functions should be lightweight and purely computational, without the overhead of constructibility.

Common Misconceptions and Mistakes

One common mistake is trying to use an arrow function as a method in an object literal and expecting this to refer to the object. Because arrow functions use lexical this, the following does not work as expected:

const obj = {
  value: 42,
  getValue: () => this.value
};
console.log(obj.getValue()); // undefined (this is the outer scope)

Another misconception is that arrow functions can be used with new if you add a prototype property manually. That doesn’t help—the engine still refuses because the function lacks [[Construct]].

When to Use Arrow Functions vs Regular Functions

Use an arrow function when you need a short, inline callback that doesn’t need its own this—for example, in Array.map() or Array.filter(). Use a regular function when you need to create a new object with new, or when you need dynamic this binding (like in an event handler).

For object methods, prefer regular functions (or method shorthand) so that this refers to the object. For callbacks where you want to capture the outer this, arrow functions are ideal.

Frequently Asked Questions

Can I make an arrow function a constructor by adding a prototype?

No. Adding a prototype property manually does not give the function the internal [[Construct]] method. The engine still throws TypeError when you use new.

Why do arrow functions not have a prototype property?

Because they cannot be used as constructors, there is no need for a prototype object to attach to new instances. The spec omits it to keep arrow functions lightweight.

What happens if I use new with an arrow function in strict mode?

It throws the same TypeError in both strict and non-strict mode. The behavior is consistent across all contexts.

Is there any way to use an arrow function with new?

No. The only workaround is to wrap the arrow function in a regular function and use that with new, but that defeats the purpose.

Do class methods have the same limitation?

No. Class methods are regular functions and can be used as constructors, but they are not enumerable and have their own this binding rules.

Why does this inside an arrow function refer to the outer scope?

Because arrow functions do not create their own this context. They capture the this value from the lexical scope where they are defined, which is why they are useful for callbacks.

Related

Formula used
in t | Finish time | min | 50 | 0
in d | Distance | km | 10 | 0
out pace | Average pace | min/km | t / d | 2
out speed | Average speed | km/h | d / (t / 60) | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.