Design Patterns · Junior · Question 16 of 75
How is the Prototype pattern related to JavaScript?
- ✓Correct answer: New objects are created from existing ones - the language itself is built on this
- 2It's a way to quickly sketch a UI without logic to show a client
- 3It's a pattern that can't be implemented in JavaScript
Explanation
The Prototype pattern is about creating objects by cloning a sample. In JS, objects inherit from other objects via the prototype chain, and Object.create(proto) creates an object with a given prototype. A UI prototype (a mockup) is an entirely different concept.