---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---
# Array.prototype.pop()

The **`pop()`** method removes the **last**
element from an array and returns that element. This method changes the length of the
array.

## Syntax

```js
pop()
```

### Return value

The removed element from the array; [`undefined`](../../../globals/undefined.mdx) if the array is empty.

## Description

The `pop()` method removes the last element from an array and returns that value to the caller. If you call `pop()` on an empty array, it returns [`undefined`](../../../globals/undefined.mdx).

[`Array.prototype.shift()`](./shift.mdx) has similar behavior to `pop()`, but applied to the first element in an array.

The `pop()` method is a mutating method. It changes the length and the content of `this`. In case you want the value of `this` to be the same, but return a new array with the last element removed, you can use [`arr.slice(0, -1)`](./slice.mdx) instead.

The `pop()` method is generic. It only expects the `this` value to have a `length` property and integer-keyed properties. Although strings are also array-like, this method is not suitable to be applied on them, as strings are immutable.
