Skip to content

new

In JavaScript, the new keyword is an operator that calls a constructor to create and return a new object. It works with class constructors, with regular functions declared with function, and with built-in constructors such as Map and Date.

For a class or a regular function, new creates an empty object whose prototype is the constructor’s .prototype property. It then runs the constructor with this bound to that object. The expression evaluates to the new object, unless the constructor returns an object of its own, in which case that object is the result. A returned primitive is ignored, but a derived class constructor that returns a primitive other than undefined throws a TypeError.

Only constructors work with new. Arrow functions, methods, and async functions aren’t constructors, so new throws a TypeError for them. Symbol() and BigInt() throw too. The reverse also holds: calling a class without new throws a TypeError. A constructor can check whether new called it with the new.target meta-property.

JavaScript new Keyword Syntax

The new operator calls a constructor, with or without an argument list:

Language: JavaScript Syntax
new <constructor>
new <constructor>([<arg1>, <arg2>, ...])

Without an argument list, new Point behaves like new Point(). The constructor expression can’t use optional chaining.

JavaScript new Keyword Examples

The new operator creates a Point instance, while calling the class without new throws:

Language: JavaScript
> class Point {
…   constructor(x, y) {
…     this.x = x;
…     this.y = y;
…   }
… }
undefined

> const origin = new Point(0, 0);
undefined
> origin
Point { x: 0, y: 0 }
> Object.getPrototypeOf(origin) === Point.prototype
true

> Point(1, 2)
Uncaught TypeError: Class constructor Point cannot be invoked without 'new'

The new expression returns a Point instance that inherits from Point.prototype. Calling the class like a plain function throws instead.

Using new with something that isn’t a constructor also throws:

Language: JavaScript
> const double = (n) => n * 2;
undefined
> new double(3)
Uncaught TypeError: double is not a constructor

Detecting new With new.target

Inside a function or constructor, the new.target meta-property refers to the constructor that new called, and it’s undefined when the function runs without new. It was added in ES2015:

Language: JavaScript
> function Point() {
…   console.log(new.target === Point);
… }
undefined

> new Point()
true
Point {}

> Point()
false
undefined

A regular function can use this check to throw a TypeError when it’s called without new, the same way classes do. In a class, new.target is the class that new called, so a base class can tell which subclass is being created. Arrow functions don’t have their own new.target and use the enclosing function’s. In class field initializers and static blocks, it’s undefined. Anywhere else, new.target is a SyntaxError, and target stays an ordinary name.

JavaScript new Keyword Use Cases

  • Creating instances of classes
  • Building objects from constructor functions written before classes existed
  • Creating built-in objects such as Map, Set, Date, and Error
  • Wrapping callback-based code in a new Promise

Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.


By Leodanis Pozo Ramos • Updated Nov. 4, 2026