Object.create()
The Object.create()
method creates a new object, using an existing object as the prototype of the newly created object.
Syntax
Object.create(proto)
Object.create(proto, propertiesObject)
Parameters
proto
- : The object which should be the prototype of the newly-created object.
propertiesObject
optional- : If specified and not
undefined
, an object whose enumerable own properties specify property descriptors to be added to the newly-created object, with the corresponding property names. These properties correspond to the second argument ofObject.defineProperties()
.
- : If specified and not
Return value
A new object with the specified prototype object and properties.