---
# System prepended metadata

title: "Array Operations \U0001F4DD"
tags: [JavaScript]

---

# Array Operations 📝
###### tags: `JavaScript`
<!-- ![](https://i.imgur.com/yjCyZ39.png)
 -->

| 分類 | 方法 |
| -------- | -------- |
| 回傳新陣列 | reduce()|


### reduce() 
> **ary.reduce(callback, ~~initialvalue~~)**
> 將陣列中的值逐一傳入回呼函式，第二參數為初始值（option）。
```javascript=
const reduceAry = [[0, 1], [2, 3]].reduce(
  (acc, cur) => {
    return acc.concat(cur);
  },
  [1, 2],
);
consoel.log(reduceAry); // [1,2,0,1,2,3] // [1,2] + [0,1] + [2,3]
```
