You can Prefer to Read or you can Watch on YouTube:
=> The pop() method removes the last element from an array
=> The pop() method returns the value that was "popped out"
Example:
// Consider an array of Fruits
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.pop(); // Removes the last element ("Mango") from fruits
Example:
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var x = fruits.pop(); // the value of x is "Mango"
Top comments (0)