|Property/method value type:||Array object|
|-||new Array(anItem1, anItem2, anItem3, ...)|
|Argument list:||aLength||An optional initial length to set the array to.|
|anItemN||A variable number of initial elements to insert into the array.|
The Array() constructor is used in a new expression to manufacture a new instance of the Array object.
The arguments passed to the constructor affect the way that the array is initialized.
If no arguments are passed, then an empty array is created. Its length will be zero and it will only have the properties it inherits from its prototype parent.
If it has a single argument, and if that argument is a numeric value that can be realized as an unsigned 32-bit integer with no loss of precision, then it is taken as a length value to initialize the array with. However, according the ECMA standard, a numeric value that is not convertible to a Unit32 should cause a run-time error. This may not be the case with all host implementations and would be considered a minor deviation from the standard. You may find that a single numeric value results in a one-element array containing that value instead of a runtime error. A single argument of non-numeric type results in an array containing one element and having a length value of 1.
If there is more than one argument, then each argument is placed into the array in the order of presentation and the length value set according to the number of arguments provided.
Netscape 2.02 does not understand the new Array() syntax. MSIE 3.02 with JScript 1.0 does not understand new Array() either. This can be simulated with objects however.
ECMA 262 edition 2 - section - 184.108.40.206
ECMA 262 edition 2 - section - 15.4.1
ECMA 262 edition 2 - section - 15.4.2
ECMA 262 edition 2 - section - 220.127.116.11
ECMA 262 edition 2 - section - 15.4.4
ECMA 262 edition 3 - section - 15.4.2