---
name: "up.util.contains"
area: "API"
kind: "JavaScript function"
parent: "up.util module"
url: "https://unpoly.com/api/up.util.contains"
---
<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.contains(value, subValue)

Returns whether the given value contains another value.

If `value` is a string, this returns whether `subValue` is a sub-string of `value`.

If `value` is an array, this returns whether `subValue` is an element of `value`.

---

## Parameters {#parameters}

### value {#value}

(required)

Type: [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | [NodeList](https://developer.mozilla.org/en-US/docs/Web/API/NodeList) | string

### subValue {#subValue}

(required)

Type: any

---

## Return value {#return-value}

Whether the value is contained.

Type: boolean

