var fruits = ["Banana", "Orange", "Apple", "Mango", "Kiwi"]; document.getElementById("demo").innerHTML = fruits; function myFunction() { fruits.splice(2, 2); document.getElementById("demo").innerHTML = fruits; }