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>
18 Related pages
- Date and Time JavaScript
- Display Date, JavaScripts
- Display Date, JS
- External JavaScripts in HTML head
- JavaScript confirm OK and Cancel
- JavaScript Promise API
- JavaScript redirect to
- JavaScript toggle class
- JS alert in php
- JS Blinking Text
- JS Date
- JS display image preview on the form before submit
- JS image inside ul li
- JS Numeric Sort
- JS prevent form resubmission
- JS, pop( ) remove last element in the array
- JS, push() adds to the last element in the array
- Timeout JS























