Constructor

Function User(name) {
  this.name = name;
  this.isAdmin = false;
}

*!*
let user = new User("Jack");
*/!*

alert(user.name); // Jack
alert(user.isAdmin); // false
  • Technically are regular functions.
  • They are named with capital letter first.
  • They should be executed only with "new" operator.

Related concepts

Constructor — Structure map

Clickable & Draggable!

Constructor — Related pages: