Kunal Tandon wrote about his run through of the four patterns in JavaScript. To create objects in JS, there are various patterns that can be followed.
The article describes briefly each of these:
- Factory pattern
- Constructor pattern
- Prototype pattern
- Dynamic prototype pattern
With the factory pattern, we create a factory that creates specified objects and returns their reference. Every time we call the factory we get a new instance. While The dynamic prototype pattern is a hybrid of the constructor pattern and the prototype pattern.
You will get code examples for each pattern. Short and sweet.
[Read More]