Riverview Church

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, ...];

EXAMPLES

CREATE

ACCESS

PUSH

POP

UNSHIFT

SHIFT

SPLICE

REVERSE

SORT

Mozilla Developer Network