Favorites

JavaScript Array.prototype.pop() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Array.prototype.pop()
JavaScript Array Instance methodThis method is supported by all modern browsers.
Updated 28th November 2026

The pop() method removes the last element from an array and returns it, changing the array's length.

Description

The pop() method removes the last element of an array and returns it. It changes the array in place. Together with push(), it lets you use an array as a stack (last in, first out).

To read the last element without removing it, use at(-1).

Calling pop() on an empty array is safe and returns undefined, but that's indistinguishable from popping an element whose value is undefined, so check length first if it matters. It's fast because no other elements need to move, unlike shift(), which removes from the start.

Syntax

array.pop()

Return Value

The removed element, or undefined if the array was empty.

Example

const stack = ['a', 'b', 'c'];
console.log(stack.pop());
console.log(stack);
console.log([].pop());

Browser Support

The following information will show you the current browser support for the Array.prototype.pop() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee