Object's create() method

Find all information about the JavaScript create() method of the Object object

Introduced in ES5.

Create a new object using the specified prototype.


const newObject = Object.create(prototype)


const animal = {}
const dog = Object.create(animal)

The newly created object will inherit the properties of all prototype objects.

You can specify a second parameter to add new properties to the object that the prototype lacks:

const newObject = Object.create(prototype, newProperties)

Among them, newProperties is the object that defines the object of each property.


const animal = {}
const dog = Object.create(animal, {
  breed: {
    value: 'Siberian Husky'
console.log(dog.breed) //'Siberian Husky'

I don't just saybreed: 'Siberian Husky'But I have to pass the property descriptor object defined at the beginning of this page.

Object.create()Usually withObject.assign():

const dog = Object.assign(Object.create(animal), {
  bark() {

Download mine for freeJavaScript beginner's manual

More js tutorials: