# Constructor

*noun*

say it: **“kun-STRUK-ter”** **/kənˈstrʌktər/**

The special method in a class, named constructor, that runs once when new builds an object and fills in its starting values.

## What is **Constructor** in JavaScript?

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

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

const guide = new Book("JavaScript");
```

## In a sentence

- “The **constructor** sets each pet's name and age the moment new Pet("Mochi", 2) runs.”

Level: Journeyman · [More JavaScript terms at this level](https://www.ask-codey.com/glossary?category=javascript&level=3)

Updated: November 9, 2026

## In other subjects

- [Constructor in C#](https://www.ask-codey.com/glossary/constructor-c-sharp)
- [Constructor in Java](https://www.ask-codey.com/glossary/constructor)
- [Constructor in OOP](https://www.ask-codey.com/glossary/constructor-oop)

Source: https://www.ask-codey.com/glossary/constructor-javascript
