DEV Community

Discussion on: Javascript OOP-1 (Classes and Objects) -

Collapse
 
enetojara profile image
Ernesto Jara Olveda

The constructor() method is called automatically when a class is initiated, and it has to have the exact name "constructor", in fact, if you do not have a constructor method, JavaScript will add an invisible and empty constructor method.

Thread Thread
 
shubhamtiwari909 profile image
Shubham Tiwari

By saying include , i meant the same
An invisible constructor will get invoked automatically if we don't create one