What is a default constructor in JavaScript?

JavascriptWeb DevelopmentFront End Technology

If a constructor method is not added, then a default constructor should be used. A default constructor is created when nothing is defined.

Syntax

Here’s the syntax −

constructor() {}

The syntax for derived class −

constructor(...args) {
   super(...args);
}
raja
Published on 30-Jan-2018 14:48:39
Advertisements