Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js array pop

//The pop() method removes and return the last element from an array:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
const lastFruit = fruits.pop();
console.log(lastFruit) //>> "Mango"
console.log(fruits) //>> ["Banana", "Orange", "Apple"]
 
PREVIOUS NEXT
Tagged: #js #array #pop
ADD COMMENT
Topic
Name
8+8 =