JavaScript 1.1+, ECMAScript 1.0+, JScript 3.0+ Nav3+, NES3+, IE 4+, Opera3+ Syntax

var variable = new Array()
var variable = new Array(int)
var variable = new Array(arg1, …, argN)


Although arrays can be created with the basic JavaScript object, the Array object provides a much easier way to create and manage arrays.

Table 6.7 lists the argument and return values associated with this object's constructors. These constructors create a new array and, in two cases, initialize the Array object based on the arguments passed in the parameter list. The constructor that has no arguments sets the length property to 0.

Table 6.7. Arguments and Return Values Associated with the Array Object
Type Item Description

Get Pure JavaScript now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.