# 🏅 Day 15 - 陣列物件整合操作應用
### 題目
請依照下方程式碼中註解的要求完成這段程式碼(補上 `...` 的部分):
```javascript=
let productInfo = {
price: 1000, // 購買價格
coupons: [
{
due_date: "2022-10-15", // 到期日
id: 123,
is_enabled: 0, // 是否啟用
percent: 0.7, // 折扣比例
title: "特惠七折", // coupon 標題
},
{
due_date: "2022-08-08", // 到期日
id: 456,
is_enabled: 1, // 是否啟用
percent: 0.5, // 折扣比例
title: "特惠五折", // coupon 標題
}
]
};
/* 請取得 coupons 陣列中 id 為 456 的 percent,並賦值給 discountPercent */
let discountPercent = ...;
/* 請取得 coupons 陣列中 id 為 456 的 title,並賦值給 title */
let title = ...;
/* 請修改 coupons 陣列中 id 為 456 的 到期日,將其延後兩日(至 2022-08-10)*/
...
/* 請取得 coupons 陣列中 id 為 456 的 is_enabled,並填入以下 if 判斷式中;
如果判斷為 true,則對「購買價格」進行折扣 */
if(...) {
/* 程式碼撰寫處,對「購買價格」進行折扣 */
...
console.log(`優惠券「${title}」已啟用`);
} else {
console.log("優惠券未啟用");
}
console.log(`購買價格 ${productInfo.price}`);
```
## 回報流程
將答案寫在 CodePen 並複製 CodePen 連結貼至底下回報就算完成了喔!
解答位置請參考下圖(需打開程式碼的部分觀看)

<!-- 解答:
let productInfo = {
price: 1000, // 購買價格
coupons: [
{
due_date: "2022-10-15", // 到期日
id: 123,
is_enabled: 0, // 是否啟用
percent: 0.7, // 折扣比例
title: "特惠七折", // coupon 標題
},
{
due_date: "2022-08-08", // 到期日
id: 456,
is_enabled: 1, // 是否啟用
percent: 0.5, // 折扣比例
title: "特惠五折", // coupon 標題
}
]
};
let discountPercent = productInfo.coupons[1].percent;
let title = productInfo.coupons[1].title;
productInfo.coupons[1].due_date = "2022-08-10";
if(productInfo.coupons[1].is_enabled) {
/* 程式碼撰寫處,對「購買價格」進行折扣*/
productInfo.price *= discountPercent;
console.log(`優惠券「${title}」已啟用`);
} else {
console.log("優惠券未啟用");
}
console.log(`購買價格 ${productInfo.price}`);
-->
回報區
---
| # | Discord | CodePen / 答案 |
|--|--|--|
| 1. | ss585801 | [Codepen](https://codepen.io/ss585801/pen/yyBxBde?editors=0010) |
| 2. | daffytseng | [Codepen](https://codepen.io/Daffy-Tseng/pen/qEWQBYV) |
| 3. | Wayne_957 | [Codepen](https://codepen.io/Wayne957/pen/WbeYNWv?editors=0010) |
| 4. | will092317 | [Codepen](https://codepen.io/xuazoblx-the-flexboxer/pen/xbKQbzm?editors=0012) |
| 5. | Xuan | [CodePen](https://codepen.io/YiXuan-Chen-the-vuer/pen/emOQmKr) |
| 6. | adengg | [CodePen](https://codepen.io/Osases/pen/dPbQoPP?editors=0012) |
| 7. | 馬德 | [CodePen](https://codepen.io/maywang/pen/gbYQbea?editors=0012) |
| 8. |ZoeKang|[CodePen](https://codepen.io/byehywmx-the-animator/pen/yyBQNbR?editors=0011)
| 9. | bian_yang_mofa | [CodePen](https://codepen.io/cssf998811/pen/QwLJbRz?editors=0011) |
| 10.| CC(tofuuu_cat) | [CodePen](https://codepen.io/CC-cat/pen/NPKEqQE?editors=0012) |
| 11. | poyi | [CodePen](https://codepen.io/poyi-the-flexboxer/pen/ByBGNXP?editors=0012) |
| 12. | Tammy | [CodePen](https://codepen.io/Tammy_Tsai/pen/zxOMBNB) |
| 13. | Tau | [CodePen](https://codepen.io/Tau-Hsu/pen/pvzQoqy?editors=0012) |
| 14. | yutzu | [CodePen](https://codepen.io/dtafsrmf-the-lessful/pen/GgKwNVy?editors=0011) |
|15.|-----這條線以下都麻糬-----|[CodePen](https://codepen.io/tsfaydhk-the-selector/pen/XJryyEK?editors=0010)|
| 16. |ally_tsao| [Codepen](https://codepen.io/ggnhmrxv-the-scripter/pen/LEPXKMO?editors=0012)|
| 17. | helena | [Codepen](https://codepen.io/helena27/pen/MYgZyMx?editors=1111)|
| 18. |Lee | [CodePen](https://codepen.io/leemo-tseng/pen/JoPwRMZ?editors=0012) |
| 19. | Ali | [CodePen](https://codepen.io/Alicia1117/pen/EaYGvzp) |
| 20. | 地呱 | [Codepen](https://codepen.io/wiibxzdw-the-bold/pen/dPbQgVY?editors=0012)|
| 21. | benson| [CodePen](https://codepen.io/DevilButler/pen/NPKoaap?editors=0011) |
| 22. | Arsian Kuo| [CodePen](https://codepen.io/Arsian-Kuo/pen/wBwNxvq)|
| 23. | JC| [CodePen](https://codepen.io/lifetimingwhisper/pen/LEPqwNL)
| 24. | 0111 | [CodePen](https://codepen.io/0111mina/pen/qEWvrdR?editors=0011) |
| 25. | Rylee | [CodePen](https://codepen.io/ryleezheng/pen/yyBWyBR)
| 26 | hsin yu | [CodePen](https://codepen.io/tina2793778/pen/KwPLaQy?editors=0012) |
| 27 | chun0075 | [CodePen](https://codepen.io/Lin-Angela/pen/QwLRwaz)|
| 28 | hsiang4100 | [CodePen](https://codepen.io/vvnrbgxl-the-typescripter/pen/EaYzXzJ?editors=0012)|
| 29 | Nora | [CodePen](https://codepen.io/ehguhcmy-the-reactor/pen/gbYJoVK) |
| 30 | JanllyGuo | [CodePen](https://codepen.io/kedugaw/pen/WbeBaNm?editors=0010)|
| 31 | shiang | [CodePen](https://codepen.io/shiang29/pen/ZYzgOyK?editors=0011)|
| 32 | HarryKuo | [CodePen](https://codepen.io/harry_kuo/pen/ByaaNaR?editors=0012) |
| 33 | JerryOOO | [CodePen](https://codepen.io/fatiangel/pen/pvoJLBX?editors=0011) |
| 34 | wuyuli_21403 | [CodePen](https://codepen.io/Job-Wilhelm/pen/RNwPyqv) |
| 35 | li-wei-min | [CodePen](https://codepen.io/leewayne/pen/ZYEbdPZ?editors=1012) |
| 36 | potato_17859 | [CodePen](https://codepen.io/Girl-Lee/pen/QwWEJrd?editors=0010) |
<!-- 可複製下方格式
| | | [CodePen]() |
-->