Constructor
Also known as class constructor
A function or class method used to initialize an object when an instance is created.
In the real world
class User { constructor(name) { this.name = name; } } initializes new User('Ada').
Also known as class constructor
A function or class method used to initialize an object when an instance is created.
class User { constructor(name) { this.name = name; } } initializes new User('Ada').