What does the new keyword actually do?
By FrontendPro Editorial Team Updated 9/26/2026
Answer
These three lines do quite different things, and the difference comes down to what new adds.
function Person() {} merely declares a function. Nothing runs. By convention the capital letter hints it is meant to be used as a constructor, but JavaScript does not enforce that — it is an ordinary function until someone calls it with new.
const person = Person() calls it as a plain function. No object is created for you, this is undefined in strict mode (or the global object otherwise), and person receives whatever the function returns — undefined if it has no return. This is the classic bug: the code looks like it made an object, then fails later with "cannot read property of undefined".
const person = new Person() invokes it as a constructor. new does four things: creates a fresh empty object, sets its prototype to Person.prototype, calls the function with this bound to that object, and returns it automatically unless the function explicitly returns a different object.
function Person(name) {
this.name = name;
}
const a = Person("Mai"); // undefined — and `this.name` leaked or threw
const b = new Person("Mai"); // Person { name: "Mai" }
b instanceof Person; // true
function Person(){} | Person() | new Person() | |
|---|---|---|---|
| What happens | Declaration only | Normal function call | Constructor call |
Value of this | — | undefined / global | The new object |
| Result | No value | Return value, often undefined | The new instance |
| Prototype link | — | None | Person.prototype |
Modern code sidesteps the trap by using class, which throws a TypeError if you forget new instead of failing quietly.
