Array.unshift() returns new length : unshift « Array « JavaScript Tutorial






<html>
<head>
<title>Array.unshift() returns new length</title>

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

var x = new Array(1,2,3,4);
var newLength = x.unshift(10);
alert(x.length);
alert(x);

//-->
</script>

</head>
<body>

<h1>Adding to the Beginning</h1>

</body>
</html>








11.35.unshift
11.35.1.Array.unshift()
11.35.2.Add element to the begin of an array by using Array.unshift
11.35.3.Array.unshift() returns new length
11.35.4.Using unshift method from zArray Library