Object.create
Creates a new object, using an existing object as the prototype of the newly created object
Syntax
Object.create(proto, propertiesObject?)Parameters
| Parameter | Type | Description |
|---|---|---|
| proto | object | null | The object that should be the prototype |
| propertiesObject | PropertyDescriptorMap | Property descriptors for the new object |
Return Value
A new object with the specified prototype object and properties
Examples
const person = {
greet() { return `Hello, I'm ${this.name}`; }
};
const alice = Object.create(person);
alice.name = 'Alice';
console.log(alice.greet()); // "Hello, I'm Alice"const nullProto = Object.create(null);
nullProto.key = 'value';
console.log('toString' in nullProto); // falseconst base = { type: 'vehicle' };
const car = Object.create(base, {
wheels: { value: 4, writable: false }
});
console.log(car.type); // 'vehicle'
console.log(car.wheels); // 4Understanding Object.create
The Object.create method in JavaScript creates a new object, using an existing object as the prototype of the newly created object. It belongs to the Object object and is one of the most widely used methods for working with object values in modern JavaScript and TypeScript applications.
The method signature is Object.create(proto, propertiesObject?). It accepts 2 parameters: proto, propertiesObject. When called, it returns a new object with the specified prototype object and properties. Understanding when and how to use create() helps you write more expressive, readable code.
Common use cases for Object.create include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like object-assign, object-getprototypeof, object-setprototypeof, enabling you to chain operations together for complex data manipulation pipelines.
Browser support for Object.create is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. It is also fully supported in Node.js and Deno. For older environments, transpilation with Babel or a polyfill may be needed.
Browser Compatibility
Supported in all modern browsers (Chrome, Firefox, Safari, Edge) and Node.js. Part of the ECMAScript standard.
Related Methods
More Object Methods
Other methods in the Object object
Related Tools
More Object Methods
Explore JavaScript Methods
Browse our complete reference of 410 JavaScript methods with syntax, examples, and explanations.