---
# System prepended metadata

title: "\U0001F3C5 DAY15 每日任務"
tags: [JS 直播班  - 2021 秋季班]

---

# 🏅 DAY15 每日任務
###### tags: `JS 直播班  - 2021 秋季班`

問題
---
請依照註解的要求完成這段程式碼:

```js=
let ProductInfo = {
    Price: 1000,  // 購買價格
    coupons:[
      {
          due_date: "2021-10-15",
          id: 123,
          is_enabled: 0,
          percent: 0.7,
          title: "特惠七折",
      },
      {
          due_date: "2021-08-08",
          id: 456,
          is_enabled: 1,
          percent: 0.5,    // 折扣比例
          title: "特惠五折",
      }
    ]
}

/* 請取得 coupons 陣列中 id 為 456 的 percent，並賦值給 discountPercent */
let discountPercent;

/* 請取得 coupons 陣列中 id 為 456 的 title，並賦值給 title */
let title;

/* 請取得 coupons 陣列中 id 為 456 的 is_enabled，並填入以下 if 判斷式中; 
如果判斷為 true，則對「購買價格」進行折扣*/

if(/* 程式碼撰寫處 */){
    /* 程式碼撰寫處，對「購買價格」進行折扣*/
    console.log(`優惠券已啟用，${title}`);
}else {
    console.log("優惠券未啟用");
}

console.log(`購買價格 ${ProductInfo.Price}`);

```





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

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

<!-- 解答
let ProductInfo = {
    Price: 1000,
    coupons:[
      {
          due_date: "2021-10-15",
          id: 123,
          is_enabled: 0,
          percent: 0.7,
          title: "特惠七折",
      },
      {
          due_date: "2021-08-08",
          id: 456,
          is_enabled: 1,
          percent: 0.5,
          title: "特惠五折",
      }
    ]
}
let discountPercent = ProductInfo.coupons[1].percent;
let title = ProductInfo.coupons[1].title;
if(ProductInfo.coupons[1].is_enabled){
    ProductInfo.Price *= discountPercent;
    console.log(`優惠券已啟用，${title}`);
}else {
    console.log("優惠券未啟用");
}
console.log(`購買價格 ${ProductInfo.Price}`);
-->

|     Slack      |                         CodePen                          |
|:--------------:|:--------------------------------------------------------:|
|  Karen Huang   |      https://codepen.io/Coding_Snorlax/pen/gOxxpPX       |
|   Iris Huang   |          https://codepen.io/ythuang/pen/gOxxpLo          |
|       YC       |           https://codepen.io/YCLu/pen/VwzzLbb            |
|    CloThEs     |     https://codepen.io/bogwdnxx-the-sans/pen/MWvvwmN     |
|   Kelvin Hsu   |         https://codepen.io/kelvin001/pen/NWvvqpO         |
|     許閔翔     |   https://codepen.io/oupbzfxq-the-scripter/pen/NWvvqjO   |
|    Aaron Tu    |          https://codepen.io/aarontu/pen/RwZZPjx          |
|     Bonnie     | https://codepen.io/bonnieli1414/pen/VwzzLMW?editors=0011 |
| 有廖先生(Rain) |        https://codepen.io/billpop741/pen/WNEEvEL         |
|      米米      | https://codepen.io/Jameshsu0407/pen/MWvvwrg?editors=0011 |
|     蔡明達     |   https://codepen.io/bmzpfyxe/pen/NWgKQZB?editors=0011   |
|      jojoy    |https://codepen.io/jojoy/pen/VwzzLBr?editors=0011|
Tim Lin|https://codepen.io/TimmyLin/pen/vYJJOVd
| AndyHuang       | https://codepen.io/HsuHuaHuang/pen/VwzWzNm                         |     |
| --------------- | ------------------------------------------------------------------ | --- |
| Metis Teng      | https://codepen.io/metis-teng/pen/QWMMbmP?editors=0012             |     |
| kevin嘉軒       | https://codepen.io/kevin-chang-the-sasster/pen/QWMMbPe             |     |
| POPEYE          | https://codepen.io/popeye_ux/pen/abyyOPp                           |     |
| Peter Chen      | https://codepen.io/yuckugjy-the-sasster/pen/mdMMJYj                |     |
| Jun Ting Lin    | https://codepen.io/jake1155/pen/QWMMbeL                            |     |
| YuriT           | https://codepen.io/wenfisht/pen/bGrRWEm                            |     |
| Arista          | https://codepen.io/arista-hsieh/pen/wvqqKKL                        |     |
| Sam             | https://codepen.io/sam-hsu/pen/rNzzOOj                             |     |
| Bella Shya      | https://codepen.io/BellaXie/pen/mdMMedz?editors=0010               |     |
| Hamaji          | https://codepen.io/hamajibashi/pen/MWvvaej                         |     |
| 溫溫            | https://codepen.io/ZPXO1928/pen/Exvwrwq?editors=0010               |     |
| 連小艾          | https://codepen.io/bolaslien/pen/rNzzOjm?editors=0012              |     |
| Jun Hua         | https://codepen.io/ydsyvkph/pen/yLooYgJ                            |     |
| lumei           | https://codepen.io/l_umei/pen/BaddopX                              |     |
| 洋蔥            | https://codepen.io/oikdkmxq-the-looper/pen/GRvvpme?editors=0011    |     |
| Gill            | https://codepen.io/Gill-Chin/pen/mdMMeWv?editors=0011              |     |
| Cheng Pei-hsuan | https://codepen.io/PaCheng/pen/zYdGKpO                             |     |
| Elaine Liu      | https://codepen.io/elaine7598/pen/dyzzYNj?editors=0010             |     |
| Anna            | https://codepen.io/kycrleao/pen/eYEEpjG?editors=0011               |     |
| ZY Hsu          | https://codepen.io/zihyin/pen/PoKKPJr?editors=0011                 |     |
| 張喆            | https://codepen.io/wow767t/pen/gOxxPba                             |     |
| Izumi 泉        | https://codepen.io/izumi-dev/pen/yLooeyP                           |     |
| Pei Ying        | https://codepen.io/Pei-Ying/pen/xxLLZxQ?editors=0011               |     |
| Leo             | https://codepen.io/a86483451/pen/gOxxPYp                           |     |
| Bean Huang      | https://codepen.io/Beanhuang/pen/GRvvopJ?editors=0011              |     |
| Sylvia-H        | https://codepen.io/Cosmosheart/pen/eYEEJmM?editors=0011            |     |
| 群嘉            | https://codepen.io/efzdamnp-the-lessful/pen/MWvvKjV?editors=1011   |     |
| Yunei           | https://codepen.io/Yunei/pen/NWvvxbj                               |     |
| Alvin           | https://codepen.io/Alvin20201116/pen/bGrrEvr?editors=0011          |     |
| Hsiang          | https://codepen.io/chao20211/pen/wvqqMQr?editors=0010              |     |
| 大衛            | https://codepen.io/exnsrpjc/pen/porrgQZ?editors=0011               |     |
| 傅劍軒          | https://codepen.io/seonkuraito/pen/qBXXbaw?editors=0010            |     |
| 艾瑞克          | https://codepen.io/ericla/pen/mdMMPrB?editors=0012                 |     |
| Celeste         | https://codepen.io/Celeste17/pen/wvqJboZ                           |     |
| Peggy Tsai      | https://codepen.io/pei-chi-tsai/pen/xxLLVRZ?editors=0011           |     |
| Jessie          | https://codepen.io/jssanji03/pen/xxLLZqB                           |     |
| Riley           | https://codepen.io/jjpxbprd/pen/KKvvzRj                            |     |
| 陳暐中          | https://codepen.io/wei-z/pen/WNEEwKm?editors=0012                  |     |
| Phil            | https://codepen.io/ctkeftjp-the-animator/pen/vYJJGVd?editors=0011  |     |
| ボンドルド      | https://codepen.io/alan60108/pen/KKvvzaJ                           |     |
| danny123        | https://codepen.io/binlandz123/pen/BaddKrO?editors=0010            |     |
| Jean Chiang     | https://codepen.io/jeanchiang1221/pen/dyzzXWj                      |     |
| 鉦勝            | https://codepen.io/atckmax823/pen/QWMMEmN?editors=1011             |     |
| Jie Du          | https://codepen.io/qgqonost-the-flexboxer/pen/vYJJKEa?editors=0011 |     |
| ZOE WU          | https://codepen.io/Zoechiueh/pen/abyyZEq?editors=0011              |     |
| 阿和            | https://codepen.io/shnny/pen/MWvvjar?editors=0011                  |     |
| Yvonne          | https://codepen.io/Evonne/pen/eYEEdGL?editors=0011                 |     |
| 雪莉            | https://codepen.io/utshang216/pen/zYddKpe                          |     |
| Steven Chan     | https://codepen.io/Steven1220/pen/wvqqzje?editors=1011             |     |
| phi             | https://codepen.io/aiya861202/pen/eYEmVjR?editors=1112             |     |
| 蔣秉彣          | https://codepen.io/the-pierre/pen/RwZporY                          |     |
| Yof             | https://codepen.io/yangyof/pen/OJjjbOE?editors=1011                |     |
| Genos           | https://codepen.io/pb220416/pen/OJjjbda                            |     |
| Lai             | https://codepen.io/co_lai/pen/WNEERNV?editors=0010                 |     |
| YOYO            | https://codepen.io/lumedkle/pen/xxLLqwQ?editors=0011               |     |
| 林小君          | https://codepen.io/hcvbcjqq-the-vuer/pen/ExvvWor                   |     |
| 黃士桓          | https://codepen.io/shr-huan-huang/pen/RwZZpOo?editors=0012         |     |
| Booker          | https://codepen.io/bookbasketball/pen/YzxxVwN                      |     |
| Vicky Kao       | https://codepen.io/vicky03035/pen/wvqqdqx?editors=1010             |     |
| Louis           | https://codepen.io/Louis164156/pen/QWMMvXe?editors=1010            |     |
| Sandy           | https://codepen.io/Sandy_L/pen/ExvvmaY?editors=0011                |     |
| Jocelyn         | https://codepen.io/enjoyful/pen/VwzzMZj?editors=1011               |     |
| Trista          | https://codepen.io/trista6140/pen/PoKKJea                          |     |
| Juno Li         | https://codepen.io/Juno026/pen/JjyyYpv?editors=0011                |     |
| 喜美            | https://codepen.io/Candace802/pen/qBXXVoY?editors=0010             |     |
| Yashien Lin     | https://codepen.io/YashienLin/pen/WNEEMeJ?editors=0010             |     |
| Yunyi           | https://codepen.io/yunyi12374/pen/ZEJbKVW                          |     |
| AKI             | https://codepen.io/akichen27/pen/KKvvLpB                           |     |
| Gui             | https://codepen.io/guitimliu/pen/ZEJJKbZ                           |     |
| sheng wei       | https://codepen.io/sheng-wei12/pen/dyzVKjO                         |     |
| 劉維倫          | https://codepen.io/lun0223/pen/JjyraGZ?editors=1112                |     |
| Page Shih       | https://codepen.io/kanawin821/pen/NWvaOxw                          |     |
| 鄭安志          | https://codepen.io/lwmtsgek/pen/NWvaEWe?editors=0012               |     |
|Mingyo|https://codepen.io/Nick-Yo/pen/bGroOdd?editors=0011 |
|Jasper|https://codepen.io/li-jasper/pen/mdMBgQJ |
| 小K | https://codepen.io/kelen1995/pen/yLozdyd |
|Van.S| https://codepen.io/fbacojji-the-selector/pen/Yzxroyr?editors=0011 |
|UnizaLin| https://codepen.io/unizalin/pen/gOxXOyE |
| ShinyChen | https://codepen.io/shinychen/pen/NWvwprq |
|kk|https://codepen.io/potatokaka/pen/zYdPZma|
|Chia Chi|https://codepen.io/ClaraChen/pen/pordrRN?editors=0011|
|Calon|https://codepen.io/Calon0118/pen/zYdPdZp|
|Ching|https://codepen.io/Jaimedede/pen/ExvbQYO|
|Alberto|https://codepen.io/AlbertoLL/pen/RwZjBOY?editors=0012|
|吐司|https://codepen.io/malolulu/pen/oNepgoP|
|柯勝華|https://codepen.io/Chill-Nick/pen/GRvyrrO?editors=0010|
|  肉魚  |  https://codepen.io/zoechen13/pen/qBXpmrw  |
|Cadiis| https://codepen.io/candiyen/pen/dyzJBmv |
|LTL| https://codepen.io/ltlin93/pen/jOLZLYE?editors=0010 |
|lingxuan| https://codepen.io/penglingxuan/pen/LYjQXeG?editors=0010 |
| 三隻小貓 | https://codepen.io/bagelover/pen/wvqyLOX?editors=0010 |
| 阿修 | https://codepen.io/edw-kyo/pen/zYdWKNq?editors=0011 |
|YU-LING TUNG|https://codepen.io/igzdflpu/pen/jOLMMrP?editors=0012|
|Irene Wang|https://codepen.io/irene-wang-the-looper/pen/PoKegGJ|
|Zooey Cheng|https://codepen.io/noraneko0430/pen/JjyBYdL?editors=0012
|zaii|https://codepen.io/ivy2846357/pen/WNEabBd?editors=0010|
|kailun|https://codepen.io/Kailun/pen/xxLQGoV|
|Jyun Chen|https://codepen.io/Jyun_C/pen/QWMooBr?editors=0011|
| 傑瑞 | https://codepen.io/auatwood909815/pen/BadEPRQ?editors=0012 |
paul|https://codepen.io/printfootya/pen/gOxyBBV?editors=0011|
