JavaScript Class constructor
JavaScript Class constructor
The constructor() method in a class is used for initializing and creating objects created within a class. It is automatically called when a class is initiated and it should have the same name as the class name. If this method is not specified then JavaScript will automatically add it. We can also access the constructor of the parent class by using the super() method.
Syntax:-
Its syntax is:- constructor(parameters)