Answers

Question and Answer:

  Home  Expert JavaScript Developer

⟩ What is Pop() method in JavaScript?

► The pop() method is similar as the shift() method but the difference is that Shift method works at the end of the array.

► The pop() method take the last element off of the given array and returns it. The array on which is called is then altered.

► For example :

var fruits = ["apple ", "banana ", "mango"];

console.log(fruits.pop() );

console.log(fruits);

► We get the following console output :

mango

["apple ", "banana "];

 184 views

More Questions for you: