+ 3
What is the pop()method in JavaScript?
3 Réponses
+ 8
pop() method removes the last element from an array and returns that element.
Example:
var arr = [1, 2, 3, 4];
console.log( arr.pop() ); // 4
console.log( arr ); // 1,2,3
+ 1
Pop() is javaScript Array method which removes and returns the last Item of Array, it is opposite of push() method which adds new item to the array at end.