# Spread & Rest with Objects — JavaScript Fundamentals: From Syntax to Async

Source: https://www.skillbyai.com/en/javascript/js-object-spread-rest

> Copy, merge and pick object properties immutably with spread and rest syntax.

## Spreading objects

`...` copies an object's own properties into a new one — great for immutable updates.

```js
const user = { name: "Ada", age: 36 };
const updated = { ...user, age: 37 };
console.log(updated);  // { name: 'Ada', age: 37 }
```

## Rest in destructuring

Pull specific keys out and gather everything else into a new object.

```js
const { name, ...rest } = { name: "Ada", age: 36, city: "London" };
console.log(name);  // Ada
console.log(rest);  // { age: 36, city: 'London' }
```

## Shallow copy only

Spread makes a **shallow** copy — nested objects inside are still shared by reference.
