Mascara: Next Generation JavaScript compiler

Try it Download Buy About Documentation Blog Contact

New operator

The new operator creates an instance of a class and calls the constructor.

Syntax definition [Help]
new classname [ ( [ arguments ] ) ] 
The arguments must match the arguments defined for the constructor.

Examples:

var c = new Car;
var v = new Volvo("Amazon");

Parameterized classes

In the case of a parameterized class, the type parameters must be supplied:
Syntax definition [Help]
new classname . < typearguments > ( [ arguments ] )

Example:

// with two type arguments:
var numbers = new Map.<string,int>;
X Try!
Mascara JavaScript Generated JavaScript

Translating...
Show compiler settings