<html>
<body>
<h2>JavaScript Array Methods</h2>
<h2>unshift()</h2>
<p>The unshift() method returns the length of the new array:</p>
<p id="demo1"></p>
<p id="demo2"></p>
<p id="demo3"></p>
<script>
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo1").innerHTML = fruits;
document.getElementById("demo2").innerHTML = fruits.unshift("Lemon");
document.getElementById("demo3").innerHTML = fruits;
</script>
<p><b>Note:</b> The unshift() method does not work properly in Internet Explorer 8 and earlier, the values will be inserted, but the return value will be <em>undefined</em>.</p>
</body>
<!-- Mirrored from www.w3schools.com/js/tryit.asp?filename=tryjs_array_unshift_return by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 02:39:30 GMT -->
</html>