Array values can be other arrays, thus making it possible to create more complex data structures such as multidimensional arrays and trees. An array with a single dimension is often called a vector, whereas a multidimensional array is called a matrix.
Object should be used instead.
Array object to construct
Array instances or by using the literal array syntax:
var array1 = new Array(arrayLength);
Creates an array with an initial length set to the specified value. The value must be specified as an unsigned integer.
var array2 = new Array(element0, element1, ...);
Creates an array with the specified values as its elements.
Arguments are optional in both cases.
Creating an array using the
Array constructor may be a bit confusing and there's a slight chance of undesired results. Therefore it is best to avoid it in favor of the more concise literal form:
var array3 = [element0, element1, ...];
Array object are available and can be called on array primitives.
Array elements can be referred to by their index using the special square bracket notation. For example:
var fruits = ["apples", "oranges", "grapes"]; fruits; // apples fruits; // grapes fruits; // oranges
Note that the first element has the index 0.
These properties are not inherited by default and are only available with arrays created by regular expression matches.
concat(array1 [, array2 [, ...]])
every(callback [, object])
filter(callback [, contextObject])
forEach(callback [, contextObject])
map(callback [, contextObject])
push(element0 [, element1 [, ...]])
reduce(callback [, initialValue])
reduceRight(callback [, initialValue])
slice(offset [, length])
some(callback [, contextObject])
splice(offset , length [, element1 [, element2 [, ...]]])
unshift(element0 [, element1 [, ...]])