ZaZaKi, a web developer Between Manchester UK & Rotterdam NL. © 2015-2024.

JS, pop( ) remove last element in the array

pop() removes the last element in the array

 


<!DOCTYPE html>
<html>
<body>

<p id="demo1"></p>

<script>

// array
var fruits = ["Banana", "Orange", "Apple", "Mango"];

// array name and POP() after it it will removes the last element in the array.
// the Mango element will be removed from the array
fruits.pop();

// the array displayed
document.getElementById("demo1").innerHTML = fruits;

</script>

</body>
</html>

Categroy:
Front-end , javascripts