---
# System prepended metadata

title: "\U0001F3C5 Day 11 - 陣列操作"
tags: [JS 直播班 - 2024 秋季班]

---

# 🏅 Day 11 - 陣列操作

### 題目
請運用課堂中教到的陣列相關知識，依照下方註解敘述，完成下方程式碼（補上 `...` 的部分）


問題
---
```javascript=
let recipe = ['sugar', 'salt', 'flour', 'fruit'];

// 1. 請使用陣列方法取得 recipe 的長度，並使用 console.log 印出
console.log(...);

// 2. 請使用陣列取值方法取得結果為 'sugar' 的值，並使用 console.log 印出
console.log(...);

// 3. 請使用陣列取值方法取得結果為 'fruit' 的值，並使用 console.log 印出
console.log(...);

// 4. 請使用陣列方法替陣列 recipe 在最後新增一個值 'butter'
recipe...;
            
// 5. 請使用陣列方法刪除陣列 recipe 第 3 筆以後的資料（刪除 flour、fruit），最後印出整個陣列
recipe...;
console.log(recipe);
```

## 回報流程

將答案寫在 CodePen 並複製 CodePen 連結貼至底下回報就算完成了喔! 
解答位置請參考下圖（需打開程式碼的部分觀看）

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

<!-- 解答： 

// 1. 
console.log(recipe.length);
// 2. 
console.log(recipe[0]);
// 3. 
console.log(recipe[3]);
// 4. 
recipe.push('butter');
// 5.
recipe.splice(2, recipe.length-1);
console.log(recipe);

補充文章 - 「JS 常見陣列方法」：
https://www.casper.tw/development/2020/10/04/js-array-methods/
-->




回報區
---
| #   | Discord | CodePen / 答案 |
| --- | ----- | ----- |
|  1  | haojing | [CodePen](https://codepen.io/hjxu/pen/rNXWoxo) | 
|02|voke|[CodePen](https://codepen.io/FiSi-the-lessful/pen/mdNOgZq)|
|03|泊岸|[CodePen](https://codepen.io/qoq77416416/pen/qBerBZp?editors=0012)|
|  04   |   蘑菇星星    | [CodePen](https://codepen.io/brrrieon-the-vuer/pen/OJKpJjK?editors=0012) | 
|05|mercury2508.| [CodePen](https://codepen.io/Mercury2508/pen/gOVmOyb) | 
|06|Hailey|[Codepen](https://codepen.io/sxbokfja-the-flexboxer/pen/XWvMWQE?editors=1011)|
|07|雪粒| [CodePen](https://codepen.io/bzykdfhw-the-bashful/pen/bGXqGye) | 
|08|tim| [CodePen](https://codepen.io/jskrtivy-the-animator/pen/dyxvyxL?editors=0010) | 
|09|Lotte| [CodePen](https://codepen.io/hmkdoxuj-the-decoder/pen/OJKpPMX?editors=0011) | 
|10|david1819| [CodePen](https://codepen.io/David-Lin-the-vuer/pen/GRVWgqp) | 
|11|Dolce_墨| [CodePen](https://codepen.io/DolceTseng1026/pen/bGXqNpg) | 
|12|yuling| [CodePen](https://codepen.io/yu-ling-peng/pen/YzmZPEX?editors=0011) |
|13|brucelee0629| [CodePen](https://codepen.io/xxhdklwi-the-decoder/pen/KKOWwmZ?editors=0011) | 
|14|朋仔|[CodePen](https://codepen.io/YPHUANG/pen/BaXWyqd?editors=0011)
|15|Mike| [CodePen](https://codepen.io/mike2049/pen/KKOWwEB?editors=0012) | 
|16|陳小廷| [CodePen](https://codepen.io/ting1124/pen/yLmMyep)|
| 17 | Lobinda | [Codepen](https://codepen.io/Lobinda/pen/NWQpqzo)|
| 18 | ABow_Chen | [Codepen](https://codepen.io/fred39392001/pen/ExqWPae)|
| 19 | 毛巾 | [Codepen](https://codepen.io/bqdcjboa-the-solid/pen/ZEgeQbr)|
| 20 | CrystalLala      | [CodePen](https://codepen.io/crystallala/pen/qBerbxe) | 
|  21   |  chris     | [CodePen](https://codepen.io/chris-chen-the-selector/pen/gOVmPyW?editors=0010) | 
|  22   |   610    | [CodePen](https://codepen.io/YI-LING-LIU/pen/zYgZqRr) |
|  23   |   KUN    | [CodePen](https://codepen.io/barry91205/pen/BaXWzgj?editors=1111) |
| 24 | yuyeh_1212 | [CodePen](https://codepen.io/yuyeh1212/pen/KKOWgyQ) |
| 25 | jimmy.0706 | [CodePen](https://codepen.io/JimmyMao/pen/xxvqEPe?editors=0012) |
| 26 | anderson666 | [CodePen](https://codepen.io/goodmanbuild/pen/rNXyMXb?editors=1111) |
| 27 | Rogan | [CodePen](https://codepen.io/RoganHsu/pen/jOgBVaJ?editors=1111) |
| 28 | yuyuhunter_0509 | [CodePen](https://codepen.io/KRcube/pen/VwopmBM?editors=0011) | 
| 29 | Mos | [CodePen](https://codepen.io/mos25399/pen/yLmMVxB?editors=0010) | 
| 30 | Kaya | [CodePen](https://codepen.io/kayaribi/pen/YzmZNZO) | 
| 31 | JRz | [CodePen](https://codepen.io/JRZHENG/pen/ZEgeLga?editors=0111) | 
| 32 | ycl325.etheddie | [CodePen](https://codepen.io/wdvikfuz-the-selector/pen/yLmMbOZ) | 
| 33    |  JIA     | [CodePen](https://codepen.io/nzaicwlw-the-styleful/pen/NWQpjdB?editors=0011) | 
| 34    |  Sonia     | [CodePen](https://codepen.io/YUJOU/pen/vYoxZZV?editors=0011) | 
| 35    |   Celine    | [CodePen](https://codepen.io/szuning/pen/MWNprXX) |
| 36    |   Jainee    | [CodePen](https://codepen.io/Jainee0110/pen/zYgZRpG) |
| 37 | a1phaki(小k) |[CodePen](https://codepen.io/a1phaki/pen/WNVpzyQ?editors=1111)|
|38|陳睿睿|[CodePen](https://codepen.io/uwmrsusb-the-solid/pen/ZEgexmy?editors=0011)|
|39|ABOOS| [CodePen](https://codepen.io/guhungyin/pen/gOVmjMQ?editors=0012) | 
|40|倫倫| [CodePen](https://codepen.io/f5badapple/pen/KKOWGYj?editors=0011) |
|41|邵|[Codepen](https://codepen.io/ukscrlno-the-typescripter/pen/MWNpzaa?editors=1011)|
|42 | GTR150 | [CodePen](https://codepen.io/Wer-Qwe/pen/PoMpLxM?editors=1111) | 
|43|jerry_66983| [CodePen](https://codepen.io/Barry-C/pen/NWQpWzx?editors=1111) |
|44|yoishere| [CodePen](https://codepen.io/yoishere/pen/ExqmVrb) |
|45|.tsz_ying | [CodePen](https://codepen.io/bekgnohe-the-selector/pen/OJKmMwR) |
|46|Glen_69515| [CodePen](https://codepen.io/glenyaochih/pen/rNXyEPz?editors=1111)|
|47|GAVI| [CodePen](https://codepen.io/qbafldcv-the-scripter/pen/bGXqxxR) | 
|48|嚼勁先生| [CodePen](https://codepen.io/James520284/pen/GRVmwPz) | 
|49|ab567ab5| [CodePen](https://codepen.io/WanTzu-Chiang/pen/JjgNezM?editors=0011) |
|50| Ruby | [CodePen](https://codepen.io/xivgaijl-the-selector/pen/GRVmPpa) |
|  51   |  alec1203     | [CodePen](https://codepen.io/soloayaya/pen/JjgJYJW?editors=1112) |
|  52   |   Ariel    | [CodePen](https://codepen.io/ariel0510/pen/eYqRBEb?editors=0011) |
|  53   |   kaka_945    | [CodePen](https://codepen.io/kay945/pen/rNXwjWV) |
|54|Tatsu| [CodePen](https://codepen.io/chindesu0207/pen/bGXRobg) | 
|  55   |   Emma    | [CodePen](https://codepen.io/Emma0919/pen/vYoJGJO) | 
|  56   |   Joannehu    | [CodePen](https://codepen.io/nelbabkv-the-flexboxer/pen/vYoJpdv?editors=0011) 
|  57   |   野鴿    | [CodePen](https://codepen.io/HoshinoSyouta/pen/JjgyayM?editors=0011) | 
|  58   |   Seris    | [CodePen](https://codepen.io/Dale-Chien/pen/gOVxqKM) | 
|59|Jim| [CodePen](https://codepen.io/JimChou/pen/gOVxqBw?editors=0011)|
|  60   |   Ed Huang    | [CodePen](https://codepen.io/yide1986/pen/bGXoBWw) |
|  61   |   Ana    | [CodePen](https://codepen.io/Ana-Wu/pen/gOVGzWB?editors=0011) | 
|  62   | yaoling.liang | [CodePen](https://codepen.io/Yao-Ling-L-/pen/JjgrVyN?editors=1012) |
|  63   | xiang5141 | [CodePen](https://codepen.io/XIANG-XIANG/pen/KKOyMXe?editors=00102) |
|  64   | yu | [CodePen](https://codepen.io/yu_ch12/pen/ZEgayYR) |
|  65   | joylu0902 | [CodePen](https://codepen.io/joylu0902/pen/PoMOQLP) |
|  66   | Yen | [CodePen](https://codepen.io/yuxxxlouyen/pen/LYwmOKX?editors=0011) | 
|  67   | Hedwig | [CodePen](https://codepen.io/adirehfz-the-encoder/pen/eYqrPVO?editors=1010) | 
|  68   | charlottelee | [CodePen](https://codepen.io/char849/pen/yLmEpNM) | 
| 69|維妮|[CodePen](https://codepen.io/Maggy-Lin/pen/LYwBVbY?editors=1010)|
| 70|iamcan|[CodePen](https://codepen.io/uhnxswdq-the-typescripter/pen/GRVXeqE)|
| 71|KOMATSU PEI|[CodePen](https://codepen.io/Komatsu2021/pen/WNVazOJ?editors=0012)|
| 72 |Nocab Wang ( 培根 )|[CodePen](https://codepen.io/PeihanWang/pen/rNXoWzw?editors=0011)|
|73|Amy(咂摳)|[CodePen](https://codepen.io/nnxucgmc-the-builder/pen/zYgebzj?editors=0011)|
|74|Kim|[CodePen](https://codepen.io/kim0101__/pen/MWNNyoX?editors=0011)|
|75|Satar| [CodePen](https://codepen.io/SatarKuo/pen/raBjJbK?editors=0011) | 
|76|ji3di|[CodePen](https://codepen.io/jwuuhtxh-the-builder/pen/OPLpdVd?editors=0011)
|77|Chuang|[CodePen](https://codepen.io/uidoytjq-the-solid/pen/vEBdeJB?editors=0011)
|78|Anna|[Codepen](https://codepen.io/Anna-Teng/pen/pvvVWwM?editors=1011)|
<!-- 可複製下方格式
|     |       | [CodePen]() | 
-->