Skip to content

Object.create()

Object.create() creates a new object with the specified prototype and optional properties.

const proto = {
greet() {
return "Hello";
},
};
const obj = Object.create(proto);
console.log(obj.greet()); // Hello