Constructor in Javascript ES6

CONSTRUCTOR :
constructor([arguments]) { ... }

The constructor method is a special method for creating and initializing an object created with a class


There can only be one special method with the name "constructor" in a class. A Syntax error will be thrown, if the class contains more than one occurrence of aconstructor method.
A constructor can use the super keyword to call the constructor of a parent class.
If you don't specify a constructor method, a default constructor is used.

Example : - 
Please click on this link  https://googlechrome.github.io/samples/classes-es6/index.html for a better example.


Comments

Popular posts from this blog

What is MQTT protocol & its use

What the hack is Call, bind & apply

What is Provider in Angular Js?