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

Creates a new object by merging together the properties from the given objects.

Source values that are `null` or `undefined` are ignored.

<nav aria-label="Contents">

#### Contents

- [Example](#example)
- [Parameters](#parameters)
- [Return value](#return-value)

</nav>

## Example {#example}

```js
let a = { a: '1', b: '2' }
let b = { b: '3', c: '4' }
up.util.merge(a, b) // result: { a: '1', b: '3', c: '4' }
```

---

## Parameters {#parameters}

### ...sources {#sources}

(required)

The objects to merge.

Sources that are `null` or `undefined` are ignored.

Type: [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects)|null|undefined>

---

## Return value {#return-value}

A new object with all merged properties.

Type: [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects)

