Name

Array — built-in support for arrays

Availability

Core JavaScript 1.1; enhanced by ECMA-262; enhanced in Navigator 4. Array functionality is available in JavaScript 1.0, but the Array object itself is not supported by Navigator 2.

Constructor

new Array()
new Array(size)
new Array(element0, 
                     element1, . . . , elementn)

Properties

length

The size of an array. JavaScript 1.1, Internet Explorer 3; ECMA-262.

Methods

concat(value, . . . )

Concatenate arrays. JavaScript 1.2.

join(separator)

Concatenate array elements to form a string. JavaScript 1.1; ECMA-262.

pop()

Remove and return the last element of an array. Navigator 4.

push(value, . . . )

Append elements to an array. Navigator 4.

reverse()

Reverse the elements of an array. JavaScript 1.1; ECMA-262.

shift()

Shift array elements down. Navigator 4.

slice(start, end)

Return a portion of an array. JavaScript 1.2.

sort(orderfunc)

Sort the elements of an array. JavaScript 1.1; ECMA-262.

splice(start, deleteCount, value, . . . )

Insert, remove, or replace array elements. Navigator 4.

toString()

Convert an array to a string. JavaScript 1.1; ECMA-262.

unshift(value, . . . )

Insert elements at the beginning of an array. Navigator 4.

Get Webmaster in a Nutshell, Second Edition 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.