constructor

Baseline
Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2016.

The constructor method is a special method of a class for creating and initializing an object instance of that class.

Note: This page introduces the constructor syntax. For the constructor property present on all objects, see Object.prototype.constructor.