Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

shift

The shift() method of the Array object removes the first element in an array and returns it.

Syntaxarray.shift()

Examples

var arr = ["a","b","c","d","e"]; var first = arr.shift(); alert( first ); /* a */ alert( arr ); /* b,c,d,e */

JavaScript

Methods

addEventListeneralertaveragebackblurconcatcreatedecodeURIdecodeURIComponentencodeURIencodeURIComponentevaleveryfilterforwardgoisArrayisFiniteisNaNjoinparseFloatparseIntpoppushpushStatereducereplaceStatereverseshiftshuffleslicesomesortspliceunshiftwrite