
Object.create() – Creates a new object with the specified prototype object. Useful for inheritance.
๐ Syntax
const newObj = Object.create(proto);
๐งช Example
const animal = { eats: true };
const rabbit = Object.create(animal);
console.log(rabbit.eats);
Comments
Post a Comment