DEV Community

Marc West
Marc West

Posted on

2

Object.create()

The Object.create() Method

Object.create is a newer method in JavaScript that can be a more simple and efficient way for you to create objects. Although there are many ways to accomplish making new objects and assigning them properties, the Object.create method is unique because it lets you bypass making a constructor function by allowing you to set any existing object as the prototype for a new object.

This method takes two parameters: the first being the object being used as the prototype, and the second an optional properties object which is used to set specific properties on the new object. When the new object is returned it will have all the properties of its prototype plus its own properties, either given through the properties object or added later with dot or bracket notation.

in conclusion, Object.create is a quick and easy way to create new objects. With the seemingly endless ways to make new objects, Object.create simplifies the process. Even with its awkward optional second parameter, it is an easy way for programmers, especially newcomers like myself, to create new objects and keep track of their inheritance.

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay