Constructor

The special class method that initializes a newly created JavaScript object.

What is Constructor in JavaScript?

Constructor — The special class method that initializes a newly created JavaScript object.

class Book {
    constructor(title) {
        this.title = title;
    }
}

const guide = new Book("JavaScript");

Level: Journeyman · More JavaScript terms at this level

Updated

In other subjects