pop() Array Method | JavaScript Array Method

somanathgoudar

Somanath Goudar

Posted on March 21, 2021

pop() Array Method | JavaScript Array Method

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
Enter fullscreen mode Exit fullscreen mode

Example:

var fruits = ["Banana", "Orange", "Apple", "Mango"];
var x = fruits.pop();      // the value of x is "Mango"
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
somanathgoudar
Somanath Goudar

Posted on March 21, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related