# 🏅 Day 12 - 陣列操作應用 ### 題目 高雄地區開始實施兵役體檢,只要符合以下其中一個條件就可以免除兵役: 1. BMI >= 35 2. 天生為扁平足 (Flatfoot) 請透過以下程式幫 Bob 判斷一下他需不需要當兵,如果需要,則用陣列方法把他加到 soldierName 陣列裡面。(補上 `...` 的部分) ```javascript= let soldierName = ["Tom", "Nick", "John"]; let bobBmi = 22; let isFlatfoot = false; if(...) { console.log("Bob 不用當兵"); } else { // 將 Bob 填入國軍名單 ... console.log("Bob 光榮入伍"); console.log(`名單: ${soldierName}`); } ``` ## 回報流程 將答案寫在 CodePen 並複製 CodePen 連結貼至底下回報就算完成了喔! 解答位置請參考下圖(需打開程式碼的部分觀看) ![](https://i.imgur.com/vftL5i0.png) <!-- 解答: ``` let soldierName = ["Tom", "Nick", "John"]; let bobBmi = 22; let isFlatfoot = false; if(bobBmi >= 35 || isFlatfoot) { console.log("Bob 不用當兵"); } else { // 將 Bob 填入國軍名單 soldierName.push("Bob"); console.log("Bob 光榮入伍"); console.log(`名單: ${soldierName}`); } ``` 補充說明: isFlatfoot 為布林值(上方的設定為 false)可以直接作為條件判斷, 若要判斷為 true (與 isFlatfoot 相反), 可以使用 ! (反轉) => 寫成 `!isFlatfoot` 便能判斷為 true 。 --> 回報區 --- | # | Discord | CodePen / 答案 | | --- | ----- | ----- | | 1 | daffytseng | [Codepen](https://codepen.io/Daffy-Tseng/pen/QwLVqmP) | | 2 | Wayne_957 | [Codepen](https://codepen.io/Wayne957/pen/ogvPGdw?editors=0011) | | 3 | HarryKuo | [CodePen](https://codepen.io/harry_kuo/pen/dPbqVKz?editors=0011)| | 4 | potato_17859 | [CodePen](https://codepen.io/Girl-Lee/pen/YPKOrvE?editors=0011 )| | 5 | sui_hsilan | [CodePen](https://codepen.io/suihsilan/pen/ByBOwbM?editors=0011)| | 6 | hsiang4100 | [CodePen](https://codepen.io/vvnrbgxl-the-typescripter/pen/bNbxYEX?editors=0011)| | 7 | ss585801 | [CodePen](https://codepen.io/ss585801/pen/yyBxBde?editors=1010)| | 8 | 馬德 | [CodePen](https://codepen.io/maywang/pen/EaYebKX?editors=0012)| | 9 | helena | [CodePen](https://codepen.io/helena27/pen/bNbxYWG?editors=1012)| | 10 | Tau | [CodePen](https://codepen.io/Tau-Hsu/pen/zxOJPVa?editors=0010)| | 11 | will092317 | [CodePen](https://codepen.io/xuazoblx-the-flexboxer/pen/mybGpPJ?editors=0012)| | 12 | bian_yang_mofa | [CodePen](https://codepen.io/cssf998811/pen/azoabeQ?editors=0012)| | 13 | adengg | [CodePen](https://codepen.io/Osases/pen/yyBxpRx?editors=0012)| | 14 | ZoeKang|[CodePen](https://codepen.io/byehywmx-the-animator/pen/qEWMoZp?editors=0011) | 15 | CC(tofuuu_cat) |[CodePen](https://codepen.io/CC-cat/pen/GgKXxQa?editors=0011) | 16 | Benson | [CodePen](https://codepen.io/DevilButler/pen/OPLoEoo?editors=0011)| | 17 | Tammy | [CodePen](https://codepen.io/Tammy_Tsai/pen/qEWMyEP)| | 18 | poyi | [CodePen](https://codepen.io/poyi-the-flexboxer/pen/OPLowyq?editors=0012)| |19| janetlai|[Codepen](https://codepen.io/eiddkqxz-the-builder/pen/OPLowxK?editors=1011) | 20 | yutzu | [CodePen]( https://codepen.io/dtafsrmf-the-lessful/pen/YPKOJGZ?editors=0011)| | 21 | JanllyGuo | [CodePen](https://codepen.io/kedugaw/pen/gbYdqee?editors=0010)| | 22|Nora| [CodePen](https://codepen.io/ehguhcmy-the-reactor/pen/pvzxoON?editors=1111)| | 23|wuyuli_21403| [CodePen](https://codepen.io/Job-Wilhelm/pen/vEBVKPP?editors=1010)| | 24 | JerryOOO | [CodePen](https://codepen.io/fatiangel/pen/qEWJRZX?editors=0011)| | 25. | pja._. | [CodePen](https://codepen.io/PJA0103/pen/NPKOXyp?editors=0012 )| | 26. | Xuan | [CodePen](https://codepen.io/YiXuan-Chen-the-vuer/pen/GgKwgvR)| | 27. | shiang | [CodePen](https://codepen.io/shiang29/pen/xbKQYab?editors=0011)| | 28.| 地呱 | [CodePen](https://codepen.io/wiibxzdw-the-bold/pen/xbKQJNX?editors=0012) | | 29. | ally_tsao | [Codepen](https://codepen.io/ggnhmrxv-the-scripter/pen/mybQZBx?editors=0012)| | 30. | Lee | [CodePen](https://codepen.io/leemo-tseng/pen/WbeLGOQ?editors=1112)| | 31. | Ali | [CodePen](https://codepen.io/Alicia1117/pen/qEWLXKM)| | 32. | Arsian Kuo | [CodePen](https://codepen.io/Arsian-Kuo/pen/wBwNmgy)| | 33. | JC | [CodePen](https://codepen.io/lifetimingwhisper/pen/WbePVNP)| | 34. | 0111 | [CodePen](https://codepen.io/0111mina/pen/ogvVBdx?editors=0011)| | 35. | 五五(evelyn_hey2024) | [CodePen]( https://codepen.io/EvelynCH/pen/GgKLqyN )| | 36. | Rylee | [CodePen]( https://codepen.io/ryleezheng/pen/pvzmzBe ) | 37. | chun0075 | [CodePen]( https://codepen.io/Lin-Angela/pen/bNbJZOY ) | 38 | hsin yu | [CodePen](https://codepen.io/tina2793778/pen/NPKVdrb?editors=0011)| 39 | li-wei-min| [CodePen](https://codepen.io/leewayne/pen/VYwvJbv?editors=1011)|