Creates a new object.
new constructor[( [arguments] )] |
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.
Remarks
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.
Example
These examples demonstrate some uses of the new operator.
В | Copy Code |
---|---|
var myObject : Object = new Object; var myArray : Array = new Array(); var myDate : Date = new Date("Jan 5 1996"); |