Availability: |
| ||||||
Property/method value type: | Array object | ||||||
JavaScript syntax: | - | Array() | |||||
- | Array(aLength) | ||||||
- | Array(anItem1, anItem2, anItem3, ...) | ||||||
Argument list: | aLength | An optional initial length for the array | |||||
anItemN | A variable number of initial elements to insert into the array. |
Calling the Array() constructor as a function behaves exactly the same as if it had been called with the new operator.
The function call Array() is equivalent to the object creation expression new Array() with the same arguments. With other primitive objects, calling the constructor as a function carries out a type conversion instead of an object instantiation.
The arguments passed to the constructor affect the way that the array is initialized in the same was as they do with a new Array() expression..
ECMA 262 edition 2 - section - 15.1.3.3
ECMA 262 edition 2 - section - 15.4.1
ECMA 262 edition 2 - section - 15.4.2
ECMA 262 edition 3 - section - 15.4.1
Prev | Home | Next |
Array() | Up | Array.Class |
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. |