The Constructor Pattern

Constructors in ECMAScript are used to create specific types of objects. There are native constructors, such as Object and Array , which are available automatically in the execution environment at runtime. It is also possible to define custom constructors that define properties and methods for your own type of object. For instance, the previous example can be rewritten using the constructor pattern as the following: