`

Constructor Functions

Constructor functions provide an optimal way to create objects using a predefined prototype. The objects are created using a new keyword. JavaScript supports multiple ways of creating object as defined here and constructor functions is one of them.
Since good understanding of constructor functions is crucial for learning object oriented concepts, let’s try to understand it through a problem.