Constructor

A constructor is a function that initializes a newly allocated object.

Related concepts:  ClassObjectMethod

Closest Wikipedia entry:  Constructor (object-oriented programming) — In class-based, object-oriented programming, a constructor (abbreviation: ctor) is a special type of function called to create an object. It prepares the new object for use, often accepting arguments that the constructor uses to set required member variables. A constructor resembles an instance method, but it differs from a method in that it has no explicit return type, it is not implicitly inherited and it usually has different rules for scope modifiers.

Authoritative Definition

Wikipedia does not necessarily offer the best fitting definition of a concept. The exact meaning we attribute to the concept of Constructor is based on principled authoritative sources such as:

Misconceptions about Constructor
18 documented Misconceptions

No known JavaScript misconceptions for this concept

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.