Constructor invocation

suggest change

When a function is invoked as a constructor with the new keyword, this is the object being constructed. If the constructor returns an object, that object is the result of new instead of the object bound to this.

function Obj(name) {
    this.name = name;
}

const obj = new Obj("Foo");

console.log(obj);

This will log

{ name: "Foo" }

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents