Array

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)

Description

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
Arguments

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.