//The pop() method removes the last element from an array:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.pop();
//>> "Mango"
//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
//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"]
var arr = ["f", "o", "o", "b", "a", "r"];
arr.pop();
console.log(arr); // ["f", "o", "o", "b", "a"]
/*The pop() method removes an element from the end of an array, while shift()
removes an element from the beginning.*/
let greetings = ['whats up?', 'hello', 'see ya!'];
greetings.pop();
// now equals ['whats up?', 'hello']
greetings.shift();
// now equals ['hello']
Array.prototype.pop()
//The pop() method removes the last element from an array
//and returns that element.
//This method changes the length of the array.