Which method removes the last element from an array?

The story behind the answer

The JavaScript `pop()` method removes the last element from an array and returns the element it removed.

For example, `["red", "blue"].pop()` returns `"blue"`, leaving the array as `["red"]`. Because pop changes the original array, it is a mutating method rather than a method that creates a modified copy. Calling it on an empty array returns `undefined` and leaves the array empty.

The method belongs to `Array.prototype`, so ordinary arrays inherit it. Its partner, `push()`, adds one or more elements to the end. At the front of an array, `shift()` removes the first element and `unshift()` adds elements there. These paired names are easy to confuse in timed quizzes.

Although pop is conceptually simple, repeated removal from the end is generally efficient because it updates the array's length and removes the final indexed element. The returned value also makes it useful for stack data structures, where the last item added is the first one removed—a pattern called last in, first out.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: