January 2020
Intermediate to advanced
548 pages
13h 36m
English
The Prototype pattern involves using plain objects to act as templates for other objects. The Prototype pattern extends this template object directly without fussing with instantiation via new or Constructor.prototype objects. You can think of it as similar to conventional constructor or Class patterns minus the constructor.
Typically, you'll first create an object to act as your template. This will have all of the methods and properties associated with your abstraction. In the case of an inputComponent abstraction, it may look like this:
const inputComponent = { name: 'Input Component', render() { return document.createElement('input'); }};
Read now
Unlock full access