JavaScriptEasy
Explain the concept of the Prototype pattern
By FrontendPro Editorial Team Updated 8/8/2026
#JavaScript
Answer
The Prototype pattern is a creational design pattern used to create new objects by copying an existing object, known as the prototype. This pattern is useful when the cost of creating a new object is more expensive than cloning an existing one. In JavaScript, this can be achieved using the Object.create method or by using the prototype property of a constructor function.
js
const prototypeObject = {
greet() {
console.log("Hello, world!");
},
};
const newObject = Object.create(prototypeObject);
newObject.greet(); // Outputs: Hello, world!
