JavaScript Design Patterns - Creational - Factory
Factory pattern creates new objects delegating which class to instantiate in subclasses.
In the below example, MovieFactory decides what kind of Movie to create.
class MovieFactory {
create(genre) {
if (genre === 'Adventure') {
return n...
nhannguyen.hashnode.dev1 min read