JavaScript new Operator
The new operator creates an object from a class or constructor function, running its constructor to set it up.
Description
The new operator creates an instance of a class or constructor function. It creates a new object linked to the constructor's prototype, runs the constructor with this bound to that object, and returns it (unless the constructor returns a different object).
Classes must be called with new, and calling them without it throws a TypeError. Some built-ins, such as Symbol and BigInt, can't be used with new, and others such as String and Number create wrapper objects you rarely want. Inside a function, new.target tells you whether it was called with new.
When a class extends another, its constructor must call super() before using this, so the parent constructor can set up the object. You can leave out the parentheses when there are no arguments, new Date, but including them is clearer and avoids precedence surprises, such as new Date().getTime() working only because of the parentheses.
Properties
- Operator
new- Category
- Other
- Precedence
- 17 (1 is lowest, 18 is highest)
- Associativity
- n/a
Syntax
new Constructor()
new Constructor(arg1, arg2, ...)Example
Browser Support
The following information will show you the current browser support for the new operator. Hover over a browser icon to see the version that first introduced support for this operator.
Desktop





Tablets & Mobile





