Both Object.create and the new keyword create objects, but in different ways. new calls a constructor and sets up prototype + initialization, while Object.create creates a plain object with a specified prototype without running any constructor. Understanding this is key to JavaScript's prototypal inheritance.
Object.create vs new in JavaScript (Prototypes, Constructors, and Inheritance)
Use guided tracks for structured prep, then practice company-specific question sets when you want targeted interview coverage.
The core difference
Both create objects, but:
newcreates an object by calling a constructor function.Object.createcreates an object with a given prototype without calling any constructor.
So the real difference is: constructor-based creation vs pure prototype-based creation.
Feature | new Constructor() | Object.create(proto) |
|---|---|---|
Calls constructor? | Yes | No |
Prototype of the object | Constructor.prototype | Exactly |
Can run initialization logic? | Yes (inside constructor) | No (unless you call a function manually) |
Can pass arguments? | Yes | No (directly) |
Typical use | Class-like instantiation | Pure delegation / manual prototype chains |
What actually happens with new
When you write:
const obj = new Foo(a, b);
JavaScript does roughly this:
1) Create an empty object
2) Set its
[[Prototype]] to Foo.prototype3) Call
Foo with this = obj4) If
Foo returns an object, use it; otherwise return objfunction Foo(x) {
this.x = x;
}
const a = new Foo(10);
// Equivalent (simplified):
const a2 = {};
Object.setPrototypeOf(a2, Foo.prototype);
Foo.call(a2, 10);
// return a2
What Object.create does
Object.create(proto) simply creates a new object whose [[Prototype]] is proto. Nothing else happens. No constructor runs. No properties are set (unless you pass a second descriptor argument).
const proto = {
greet() {
return 'hi';
}
};
const obj = Object.create(proto);
obj.greet(); // 'hi'
obj.hasOwnProperty('greet'); // false (comes from prototype)
Important interview traps
1) Object.create(null) creates an object with no prototype. It does not inherit from Object.prototype. No toString, no hasOwnProperty. Useful for pure dictionaries / maps.
2) Forgetting initialization: With Object.create, if you need state, you must set it manually or call an init function.
3) class is just syntax sugar: class A {} still uses new and prototypes under the hood.
Inheritance patterns
// Using new (constructor/class style)
function Animal(name) {
this.name = name;
}
Animal.prototype.speak = function () {
return this.name + ' makes a noise';
};
function Dog(name) {
Animal.call(this, name); // init
}
Dog.prototype = Object.create(Animal.prototype);
Dog.prototype.constructor = Dog;
const d1 = new Dog('Rex');
// Using pure delegation (Object.create style)
const animal = {
speak() {
return this.name + ' makes a noise';
}
};
const dog = Object.create(animal);
dog.name = 'Rex';
When should you use which?
- Use
new/classwhen: - You want a clear construction step
- You need arguments + validation + setup logic
- You follow a class-like domain model
- Use
Object.createwhen: - You want pure prototype delegation
- You want to avoid constructor side effects
- You want special objects like
Object.create(null) - You are building lightweight objects that just delegate behavior
One-sentence answer
new creates an object by running a constructor and wiring its prototype, while Object.create creates an object with a specified prototype only, without calling any constructor.