JavaScript Array pop()
Example
Remove the last element of an array:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.pop(); // Removes "Mango"
Try it Yourself »
Definition and Usage
The pop() method removes the last element of an array.
pop() returns the element it removes.
pop() changes the length of the array.
Tip: To remove the first element of an array, use shift() instead.
Browser Support
pop() is fully supported in all browsers:
| Chrome | IE | Edge | Firefox | Safari | Opera |
| Yes | Yes | Yes | Yes | Yes | Yes |
Syntax
array.pop()
Parameters
| None |
Technical Details
| Return Value: | The removed array item. The item can be a string, a number, an array, an object, or any other type allowed in an array. |
|---|---|
| JavaScript Version: | ECMAScript 1 |
Example
pop() returns the element it removes:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.pop(); // Returns "Mango"
Try it Yourself »

