JavaScript (ES2026) reference · Object Methods

JavaScript Object.create() Method

Create a new object with the given prototype (or null for an object with no inherited properties at all).

JavaScript (ES2026) Since ES5

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

Object.create(proto, propertiesObject)

Parameters

ParameterDescription
proto The prototype for the new object, or null.
propertiesObject optional Property descriptors to add.

Return value

A new object.

Examples

Set the prototypeTry it yourself
const animal = { speak() { return `${this.name} makes a sound`; } };
const dog = Object.create(animal);
dog.name = "Rex";
console.log(dog.speak(), Object.getPrototypeOf(dog) === animal);

Output

Rex makes a sound true
A truly empty dictionaryTry it yourself
const dict = Object.create(null);
dict.toString = "just data";
console.log("hasOwnProperty" in dict, dict.toString);

Output

false just data

Version history

VersionChange
JavaScript ES5Added

Was this page helpful?