JavaScript Object.create() Method
The Object.create() static method creates a new object with a chosen prototype, which is useful for inheritance and for creating objects with no prototype at all.
Description
The Object.create() static method creates a new object that inherits from the object you pass as its prototype. Properties not found on the new object are looked up on the prototype.
Object.create(null) creates an object with no prototype at all, so it has no inherited properties like toString; this used to be a common way to make a safe dictionary, although a Map is now usually better. For inheritance in everyday code, class syntax is clearer.
The second argument takes property descriptors, the same format as Object.defineProperties(), so properties created this way are non-writable, non-enumerable and non-configurable unless you say otherwise. Passing something other than an object or null as the prototype throws a TypeError.
Syntax
Object.create(proto)
Object.create(proto, propertiesObject)Parameters
- protoThe object to use as the new object's prototype, or
null. - propertiesObjectOptional. Property descriptors to define on the new object.
Return Value
A new object with the given prototype.
Example
Browser Support
The following information will show you the current browser support for the Object.create() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





