Concepts

Constructor function

Try the free JavaScript compiler

An ordinary constructible function used with new to initialize a receiver. Its prototype property normally supplies the receiver prototype. Not every callable is constructible.

Formal Syntax & Structure

javascript syntaxjavascript
function Name(args) { /* initialize this */ }

Working Example

Example Snippetjavascript
function Item(n){this.n=n;}console.log(new Item(7).n);
JavaScript Reference