shift (JavaScript)

Removes the first element of an array.

Defined in

Array (Standard - JavaScript)

Syntax

shift() : java.lang.Object
Return value Description
java.lang.Object The removed element.

Usage

This method modifies the base array.

Examples

This computed label removes and displays the first element of an array.
var a = new Array("one", "two", "three");
a.shift() // one