<html>
<body>
<h2>JavaScript Array Methods</h2>
<h2>push()</h2>
<p>The push() method returns the new array length.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo1"></p>
<p id="demo2"></p>
<script>
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo1").innerHTML = fruits;
function myFunction() {
document.getElementById("demo2").innerHTML = fruits.push("Kiwi");
document.getElementById("demo1").innerHTML = fruits;
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/js/tryit.asp?filename=tryjs_array_push_length by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 02:39:30 GMT -->
</html>