Use Array.shift to remove the first element from an array : Shift « Array « JavaScript Tutorial






<html>
<head>
<title>Removing the first Element</title>

<script language="javascript" type="text/javascript">
<!--

var x = new Array(1,2,3,4);
var firstElement = x.shift();
alert(firstElement);

alert(x.length);
alert(x);
//-->
</script>

</head>
<body>

<h1>Removing the first Element</h1>

</body>
</html>








11.26.Shift
11.26.1.Array.shift()
11.26.2.Use Array.shift to remove the first element from an array
11.26.3.Using shift method from zArray Library