Register now or log in to join your professional community.
<html>
<body>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo").innerHTML = fruits;
function myFunction() {
fruits.pop();
document.getElementById("demo").innerHTML = fruits;
}
</script>
</body>
</html>