---
name: "up.util.remove"
area: "API"
kind: "JavaScript function"
parent: "up.util module"
url: "https://unpoly.com/api/up.util.remove"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.util module](https://unpoly.com/api/up.util.md)</nav>

# up.util.remove(array, element)

Removes the given element from the given array.

This changes the given array.

---

## Parameters {#parameters}

### array {#array}

(required)

The array to change.

Type: [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<T>

### element {#element}

(required)

The element to remove.

Type: T

---

## Return value {#return-value}

The removed element, or `undefined` if the array didn't contain the element.

Type: T | undefined

