CKTIS / JavaScript
new — invoking a constructor
The new operator invokes a constructor with supplied arguments and returns an object. For an ordinary constructor function, it creates an object linked to the function's prototype and exposes that object inside the function as this.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
new Constructor(arg1, arg2)
new Constructor()new is a keyword used to invoke a constructor: new Constructor(arg1, arg2). With no arguments, you can write new Constructor() or omit the parentheses: new Constructor. Explicit () makes the intent easier to read. new is a reserved word, so it cannot be a variable name.
For an ordinary constructor function, new creates an object, sets its internal prototype to Constructor.prototype if that value is an object, and executes the function with the new object as this. If Constructor.prototype is not an object, an appropriate default object prototype is used instead. Arguments are passed to the function's parameters.
If such a constructor explicitly returns an object, that object replaces the construction result. A returned primitive value, including null, is ignored. This describes base constructors; derived class constructors have additional rules for super() and return values.
Not every function is a constructor: arrow functions do not support new, and attempting to use them this way throws TypeError. A class must be invoked through construction rather than a plain Constructor() call. new is an ECMAScript language mechanism, not a Web API; availability of a particular constructor is a separate question.
Examples
function User(name) {
this.name = name;
}
const user = new User("Ada");
console.log(user.name);
console.log(Object.getPrototypeOf(user) === User.prototype);Result
Ada true
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.