The Factory Pattern

The factory pattern is a well - known design pattern used in software engineering to abstract away the process of creating specific objects. With no way to define classes in ECMAScript, developers created functions to encapsulate the creation of objects with specific interfaces, such as in this example: