Language Reference |
Creates a new object.
The constructor argument calls object's constructor. The parentheses can be omitted if the constructor takes no arguments.
The new operator performs the following tasks:
The constructor then initializes the object according to the arguments passed to the constructor. These are examples of valid uses of the new operator:
- It creates an object with no members.
- It calls the constructor for that object, passing a pointer to the newly created object as the this pointer.my_object = new Object; my_array = new Array(); my_date = new Date("Jan 5 1996");