Array

An array stores information in an index.

The array may be created with either new Array() or [].

Push adds an item to the end of the array.

Pop removes an item from the end of the array.

Unshift adds an item to the start of the array.

Shift removes an item from the start of the array.

Splice adds or removes items at a given index within the array.

Reverse organizes the items of the array into reverse order.

Sort organizes the items of the array into alphabetical or numerical order.

Syntax

var variable = new Array(item1, item2, ...);
var variable = [item1, item2, ...];

Example | Create

Example | Access

Example | Push

Example | Pop

Example | Unshift

Example | Shift

Example | Splice

Example | Reverse

Example | Sort

External

Mozilla Developer Network