Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How to removes the last element from an array in javascript ?

user-image
Question added by mohamed ahmed mahmoud , مصمم مواقع انترنت web designer , conect
Date Posted: 2017/03/15
medhatmahmoud mahmoud
by medhatmahmoud mahmoud , Web Designer , Connect Computer Service Co

<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>

More Questions Like This