MDN / Constructor
MDN / Constructor
A constructor is a specialized that generates with the same shape and behavior. The constructor initializes this object with some data specific to the object. The concept of a constructor can be applied to most languages.
In , a constructor is usually declared within a class, but it can also be declared as a function. In fact, any function that can be called with the new operator is a constructor.
See also
newoperator in JavaScriptConstructor on Wikipedia