JavaScript

Constructor

Definition

A special method inside a class that is called when a new instance is created with the `new` keyword. It initializes the object's properties and sets up its initial state.

Code Example

Javascript
Tip: Modify the code above and click “Run” to see the results

Learn More

Related Terms