Availability: |
| ||||||||
Property/method value type: | An object whose type depends on the constructor | ||||||||
JavaScript syntax: | - | myObject = new aConstructor | |||||||
- | myObject = new anObject(someArguments) | ||||||||
Argument list: | aConstructor | An object constructor function | |||||||
anObject | An object to clone | ||||||||
someArguments | A collection of initial values for the new instance |
The new operator creates a new instance of the object it is operating on.
As the object is created, the receiver's Construct method is called with no arguments passed to it. Any initialization is only carried out by the Construct method.
The associativity is from right to left.
Refer to the Operator Precedence topic for details of execution order.
Typically this would be used to instantiate core objects of the following types:
Array
Boolean
Date
Function
Number
Object
RegExp
String
This can also be used to instantiate some host objects.
ECMA 262 edition 2 - section - 11.2.2
ECMA 262 edition 2 - section - 11.2.4
ECMA 262 edition 2 - section - 15
ECMA 262 edition 3 - section - 11.2.2
Wrox Instant JavaScript - page - 15
Wrox Instant JavaScript - page - 21
Prev | Home | Next |
netscape.security.PrivilegeManager | Up | Newline |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |