---
# System prepended metadata

title: 展開語法

---

#    展開語法

```javascript=

var person = { name: 'chris', age: 19, isMarried: true }
console.log( {...person} ) // -> { name: 'chris', age: 19, isMarried: true }
console.log( person === {...person} ) // -> false, 是新物件唷

// 展開 person 屬性並與新 age 屬性值合併輸出新物件
function changeAge (person, newAge) {
  return { ...person, age: newAge }
}

console.log(changeAge(person, 10)) 
// -> { name: "chris", age: 10, isMarried: true }
```

* 個人程式碼說明

![](https://i.imgur.com/lzAT2XA.png)
