Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

Array

Description

The Array Array for JS 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

1 · Create

2 · Access

3 · Push

4 · Pop

5 · Unshift

6 · Shift

7 · Splice

8 · Reverse

9 · Sort

HomeMenu