FANDOM


Programmer's Wiki
This page has been moved to the Programmer's Wiki.
Please do not make any changes or additions to this page.

Any modifications, if still appropriate, should be made on Array shift at the Programmer's Wiki.

function array_shift(arr) {
	var shift = arr.shift();
	return shift;
}

Example Javascript UsageEdit

arr = new Array('dog', 'cat', 'lion', 'tiger', 'bear');
var firstitem = array_shift(arr);
alert (firstitem); /* Gives:  dog  */ 
document.write(arr); /* Gives:  cat,lion,tiger,bear  */