Junior JavaScript

What is Object.create()?

Creates a new object with the specified prototype object.

Example:

const parent = { greet() { console.log("Hello"); } };

const child = Object.create(parent);

child.greet(); // Hello

More from JavaScript Tutorial

All questions for this course