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

Maps each element using a mapping function, then [flattens](https://unpoly.com/api/up.util.flatten.md) the result into a new array.

---

## Parameters {#parameters}

### list {#list}

(required)

Type: [List](https://unpoly.com/api/List.md) | Iterator

### mapping {#mapping}

(required)

Type: Function(element)

---

## Return value {#return-value}

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

