Use Array.shift to remove the first element from an array : Shift : Array JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Array » Shift »

 

Use Array.shift to remove the first element from an array

















<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>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Array
» Shift