# 🏅 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 連結貼至底下回報就算完成了喔! 解答位置請參考下圖(需打開程式碼的部分觀看)  <!-- 解答: // 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 / 答案 | | --- | ----- | ----- | | 01 | potato_17859 | [CodePen](https://codepen.io/Girl-Lee/pen/YPKjKrL?editors=0011) | | 02 | adengg | [CodePen](https://codepen.io/Osases/pen/GgKXKmx?editors=0012) | | 03 | 馬德 | [CodePen](https://codepen.io/maywang/pen/emOjqqw?editors=0011) | | 04 | sui_hsilan | [CodePen](https://codepen.io/suihsilan/pen/emOLOEN?editors=0002) | | 05 | Wayne_957 |[Codepen](https://codepen.io/Wayne957/pen/EaYeYaj?editors=0012) | | 06 | HarryKuo | [CodePen](https://codepen.io/harry_kuo/pen/MYgqgxK?editors=0012) | | 07 | Tau |[Codepen](https://codepen.io/Tau-Hsu/pen/MYgqgRy?editors=0012) | |08| Nora | [CodePen](https://codepen.io/ehguhcmy-the-reactor/pen/JoPajKp?editors=1111) | |09| ZoeKang|[CodePen](https://codepen.io/byehywmx-the-animator/pen/yyBxLzM?editors=0011) | 10 | bian_yang_mofa | [CodePen](https://codepen.io/cssf998811/pen/MYgXOmr?editors=0012) | | 11 | will092317 | [CodePen](https://codepen.io/xuazoblx-the-flexboxer/pen/yyBxLmP) | | 12 | helena | [CodePen](https://codepen.io/helena27/pen/jENvEzx?editors=0012) | | 13 | poyi | [CodePen](https://codepen.io/poyi-the-flexboxer/pen/zxOJrEb?editors=0012) | | 14 | Tammy | [CodePen](https://codepen.io/Tammy_Tsai/pen/mybGVpr) | | 15 | daffytseng | [Codepen](https://codepen.io/Daffy-Tseng/pen/ogvPzKL) | | 16 | CC(tofuuu_cat) | [Codepen](https://codepen.io/CC-cat/pen/YPKOpxr?editors=0012) | | 17 | janetlai|[Codepen](https://codepen.io/eiddkqxz-the-builder/pen/gbYdGrX?editors=1111) | 18 | hsiang4100|[Codepen](https://codepen.io/vvnrbgxl-the-typescripter/pen/KwPxypp?editors=0010) | 19 | benson | [CodePen](https://codepen.io/DevilButler/pen/KwPxeoL?editors=0011) | | 20. | yutzu | [CodePen](https://codepen.io/dtafsrmf-the-lessful/pen/VYZGEvm?editors=0011) | | 21. | JanllyGuo | [CodePen](https://codepen.io/kedugaw/pen/ZYzMwXg?editors=0010) | | 22. | wuyuli_21403 | [CodePen](https://codepen.io/Job-Wilhelm/pen/MYgPeZp?editors=1010) | | 23. | JerryOOO | [CodePen](https://codepen.io/fatiangel/pen/OPLBbKB?editors=0011) | | 24. | pja._. | [CodePen](https://codepen.io/PJA0103/pen/NPKOXwp?editors=0012) | | 25. | Xuan | [CodePen](https://codepen.io/YiXuan-Chen-the-vuer/pen/jENQEwB) | | 26. | shiang | [CodePen](https://codepen.io/shiang29/pen/yyBQvXx?editors=0011) | | 27.| 地呱 | [CodePen](https://codepen.io/wiibxzdw-the-bold/pen/QwLJBPw?editors=0012) | | 28. | ally_tsao | [Codepen](https://codepen.io/ggnhmrxv-the-scripter/pen/YPKRoQE?editors=0012)| |29.|Lee|[Codepen](https://codepen.io/leemo-tseng/pen/ZYzVOdO?editors=1112)| | 30. | Ali | [CodePen](https://codepen.io/Alicia1117/pen/XJroaze) | |31.|Arsian Kuo|[Codepen](https://codepen.io/Arsian-Kuo/pen/emOxMNx)| |32.|JC|[Codepen](https://codepen.io/lifetimingwhisper/pen/pvzGXYB)| | 33. | 0111 | [CodePen](https://codepen.io/0111mina/pen/vEBPgXG?editors=0010) | | 34. | 五五(evelyn_hey2024) | [CodePen](https://codepen.io/EvelynCH/pen/ZYzwjaN) | | 35. | 佩妮 | [CodePen](https://codepen.io/bmxbpggh-the-flexboxer/pen/RNbOQre?editors=0012) | | 36 | hsin yu | [CodePen](https://codepen.io/tina2793778/pen/pvzBYBO?editors=0011) | | 37 | Rylee | [CodePen](https://codepen.io/ryleezheng/pen/WbeBeeq) | 38 | chun0075 | [CodePen](https://codepen.io/Lin-Angela/pen/qEWwvYe) | 38 | li-wei-min | [CodePen](https://codepen.io/leewayne/pen/ByaogzW?editors=1011) <!-- 可複製下方格式 | | | [CodePen]() | -->
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up