The pseudo-property lets you detect whether a function or constructor was called using the new operator. In constructors and functions invoked using the new operator, returns a reference to the constructor or function. In normal function calls, is undefined.

Try it



The syntax consists of the keyword new, a dot, and the identifier target. Normally, the left-hand side of the dot is the object on which property access is performed, but here, new is not an object.

The pseudo-property is available in all functions.

In class constructors, it refers to the constructed class.

In ordinary functions, it refers to the function itself, assuming it was invoked via the new operator; otherwise is undefined.

In arrow functions, is inherited from the surrounding scope.

Examples in function calls

In normal function calls (as opposed to constructor function calls), is undefined. This lets you detect whether a function was called with new as a constructor.

function Foo() {
  if (! {
    throw new Error("Foo() must be called with new");
  console.log("Foo instantiated with new");

new Foo(); // Logs "Foo instantiated with new"
Foo(); // Throws "Foo() must be called with new" in constructors

In class constructors, refers to the constructor that was directly invoked by new. This is also the case if the constructor is in a parent class and was delegated from a child constructor. points to the class definition of class which is initialized. For example, when b was initialized using new B(), the name of B was printed; and similarly, in case of a, the name of class A was printed.

class A {
  constructor() {

class B extends A {
  constructor() {

const a = new A(); // Logs "A"
const b = new B(); // Logs "B"


ECMAScript Language Specification
# sec-built-in-function-objects

Browser compatibility

BCD tables only load in the browser

See also