Export (0) Print
Expand All

new Operator

Creates a new object.

new constructor[( [arguments] )] 

constructor

Required. Object's construction. The parentheses can be omitted if the constructor takes no arguments.

arguments

Optional. Any arguments to be passed to the new object's constructor.

The new operator performs the following tasks:

  • It creates an object with no members.

  • It calls the constructor for that object, passing a reference to the newly created object as the this pointer.

  • The constructor then initializes the object according to the arguments passed to the constructor.

These examples demonstrate some uses of the new operator.

var myObject : Object = new Object;
var myArray : Array = new Array();
var myDate : Date = new Date("Jan 5 1996");

Community Additions

ADD
Show:
© 2014 Microsoft