---
# System prepended metadata

title: "\U0001F3C5 Day 14 - 物件取值"
tags: [JS 直播班 - 2022 秋季班]

---

---
tags: JS 直播班 - 2022 秋季班
---
# 🏅 Day 14 - 物件取值

在物件內新增、修改、取得屬性的方法有以下兩種:

1. 點記法 (Dot notation)

```javascript=
let obj = {};
obj.key = "value";  // 新增或修改
console.log(obj.key); // 取得
```

2. 括弧記法 (Bracket notation)
```javascript=
let obj = {};

// 當屬性的值帶有小數點、空格或是數字時可以使用，記得要加上引號 (單引號或雙引號皆可)
obj['k e y'] = "value";  // 新增或修改
console.log(obj['key']); // 取得
```

### 題目

請觀看下方程式碼，依照註解敘述完成程式碼（補上 `...` 的部分）：

```javascript=
let weather = {
  country: "高雄",
  "PM2.5": 35,
  isSunny: false,
  rainingRegion: ['鼓山', '鹽埕', '旗津'],
  rainFall: {
    鼓山: 400,
    鹽埕: 300,
  }
} 

// 取得 country 的值，並使用 console.log 印出
console.log(...); 

// 取得 "PM2.5" 的值，並使用 console.log 印出
console.log(...);

// 取得 isSunny 的值，並使用 console.log 印出
console.log(...); 

// 取得 rainingRegion 陣列的第一個值 '鼓山'，並使用 console.log 印出
console.log(...); 

// 在 rainFall 新增一個屬性名為「旗津」、設定值為 200，並，並使用 console.log 印出 rainFall 的值
...
console.log(rainFall);
```



## 回報流程

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

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

<!-- 解答：  

// 取得 country 的值
console.log(weather.country);  // 方法一
console.log(weather["country"]);  // 方法二


// 取得 "PM2.5" 的值
console.log(weather["PM2.5"]); 


// 取得 isSunny 的值
console.log(weather.isSunny);  // 方法一
console.log(weather["isSunny"]);  // 方法二


// 取得 rainingRegion 陣列的第一個值 '鼓山'
console.log(weather.rainingRegion[0]); 


// 在 rainFall 新增一個屬性名為「旗津」、設定值為 200，並輸出結果
weather.rainFall.旗津 = 200; // 方法一
console.log(weather.rainFall);

weather["rainFall"]["旗津"] = 200; // 方法二
console.log(weather["rainFall"]);
-->




回報區
---


|        Discord        |                               CodePen / 答案                                |
|:---------------------:|:---------------------------------------------------------------------------:|
|     Alex Chang#1548   |     [Codepen](https://codepen.io/alex4869/pen/ExLqxEG?editors=0011)|  | 
|     masterYan#2480      |             [Codepen](https://codepen.io/htzwgoqt-the-looper/pen/MWGMGeR?editors=0010)|  |     CloThEs#7837      |             [Codepen](https://codepen.io/CloThEsZ/pen/eYrwgNM)              |
|      SASIMI#5099      |            [Codepen](https://codepen.io/sashimi1327/pen/NWMLgmv)            |
|       薯餅#3581       |           [Codepen](https://codepen.io/ColdingPoTaTo/pen/rNvEjxK)           |
|       威0#6919        |     [Codepen](https://codepen.io/n0918679182/pen/WNJqRGO?editors=0012)      |
|      albee#9121       |            [Codepen](https://codepen.io/albee-chang/pen/QWrReqo)            |
|       Wei#2330        |     [Codepen](https://codepen.io/ixfjxrbo-the-typescripter/pen/jOxjyMG)     |
|       yumy#1940       |      [Codepen](https://codepen.io/yumy_yamg/pen/abGgpmP?editors=0011)       |
|       Ayre#0016       |     [Codepen](https://codepen.io/yichunlin09/pen/gOzNgLr?editors=0010)      |
|     AuroraC#6539      |       [codepen](https://codepen.io/AuroraC/pen/NWMVEja?editors=0012)        |
|      君Jyun#0147      |       [codepen](https://codepen.io/Okaybeok/pen/LYmKxbo?editors=0011)       |
|      azami#5986       |               [Codepen](https://codepen.io/azami/pen/bGMPgqW)               |
|        YC#2522        |               [CodePen](https://codepen.io/YCLu/pen/dyeLMpL)                |
|    jimmyFang#9575     |       [CodePen](https://codepen.io/pohxiqqo/pen/QWrXdgq?editors=0010)       |
|     MJ_Eddie#5258     |             [CodePen](https://codepen.io/nick-lin/pen/ZEodLXj)              |
|      心幻羽#0056      |     [CodePen](https://codepen.io/linglingsyu/pen/dyeBNdP?editors=1112)      |
|      cotton#7163      |       [CodePen](https://codepen.io/cottonT/pen/yLjdgoj?editors=0011)        |
|    Daisy Li #4231     | [CodePen](https://codepen.io/lidairong-gmail-com/pen/YzLoNpz?editors=0012)  |
|      hungya#0773      |      [CodePen](https://codepen.io/hungya777/pen/poVXRWL?editors=0011)       |
|      Clara#1275       |             [CodePen](https://codepen.io/bsupixqu/pen/KKRjaZo)              |
|        YI#0863        |        [CodePen](https://codepen.io/YI0305/pen/poVXRVK?editors=0012)        |
|       無名#6427       |       [CodePen](https://codepen.io/Nomoney/pen/MWGxWxa?editors=0011)        |
|     yoshidc#0455      |             [CodePen](https://codepen.io/yoshiyyc/pen/vYjqgaG)              |
|       Data#9297       |            [CodePen](https://codepen.io/kirakira72/pen/bGMPgxY)             |
|    hsiung阿熊#4079    |             [Codepen](https://codepen.io/hsiungchi/pen/OJZeWrj)             |
|       Tami#6742       |         [CodePen](https://codepen.io/wqsdqbjn-the-vuer/pen/RwyzKOK)         |
|    shinyhung#3825     |      [CodePen](https://codepen.io/sean_1215/pen/VwxJPOj?editors=1011)       |
|    LHchien33#6232     |      [CodePen](https://codepen.io/lin_chien/pen/GRdbram?editors=0011)       |
|     kenki100#0068     |              [codepen](https://codepen.io/ken100/pen/gOzNgzg)               |
|       m_m#5493        |             [Codepen](https://codepen.io/minnn7716/pen/poVXRXx)             |
|       Peng#9811       |             [codepen](https://codepen.io/peng-027/pen/OJZeWex)              |
|       Ohno#1144       |       [Codepen](https://codepen.io/mmaa7850/pen/ZEodLgP?editors=0011)       |
|        VT#0895        |               [Codepen](https://codepen.io/vt197/pen/oNdrZjL)               |
|     我是泇吟#5189     |             [CodePen](https://codepen.io/kljuqbxs/pen/VwxJpLm)              |
|      Judy☻ #7874      |       [CodePen](https://codepen.io/hsiaohan/pen/rNvEyxX?editors=0011)       |
|      IreneY#0086      |        [codepen](https://codepen.io/HalfPlannedJourney/pen/JjvQWKG)         |
|      楓之聲#6945      |             [Codepen](https://codepen.io/sshane258/pen/ExLBWgj)             |
|       威爾#1694       |              [CodePen](https://codepen.io/WILL_Wu/pen/zYjVZox)              |
|      Velma#1693       |        [Codepen](https://codepen.io/Ze1225/pen/ExLBWya?editors=0010)        |
|       圈圈#4060       |  [Codepen](https://codepen.io/wjejfczn-the-bold/pen/GRdbxOZ?editors=1111)   |
|    KatyChiang#1554    |       [Codepen](https://codepen.io/Kai0819/pen/jOxjBBd?editors=0011)        |
|     mandylai#4055     |            [Codepen](https://codepen.io/mandy-lai-2/pen/zYjVZZG)            |
|       kuku#3118       |     [Codepen](https://codepen.io/mengting-ku/pen/dyeBvVW?editors=1011)      |
|    jackson204#6363    |      [Codepen](https://codepen.io/jackson204/pen/xxjoqpE?editors=1111)      |
|      amy芳#1385       |            [Codepen](https://codepen.io/amy-chieng/pen/JjvQWMb)             |
|     hannahTW#2224     |      [Codepen](https://codepen.io/hangineer/pen/NWMZppO?editors=0011)       |
|    Ron Liang#7277     |              [Codepen](https://codepen.io/ron-go/pen/RwyzpQx)               |
|    JustinLiu#9699     |      [CodePen](https://codepen.io/justin0227/pen/oNdrZPe?editors=0011)      |
|      yawun#0042       |             [CodePen](https://codepen.io/monicalin/pen/ZEodejY)             |
|    勁辣雞腿寶#5817    |      [CodePen](https://codepen.io/orz311013/pen/JjvQWwN?editors=0011)       |
|      JackC#0411       |              [CodePen](https://codepen.io/key0329/pen/LYmKWMj)              |
|   jacky010080#0880    |    [CodePen](https://codepen.io/Yen-Jung-Chen/pen/oNdrZJG?editors=0011)     |
|     RyanTsai#8906     |             [CodePen](https://codepen.io/linlaose/pen/XWqLMoK)              |
| 軟綿綿 (๑•ᴗ•๑) ♡#3627 |     [CodePen](https://codepen.io/Connie-Chien/pen/ZEodeVb?editors=0012)     |
|    SunnyCheng#4113    |      [CodePen](https://codepen.io/Sunny0509/pen/eYrwvXJ?editors=0011)       |
|       大衛#4869       |       [CodePen](https://codepen.io/exnsrpjc/pen/rNvEyrO?editors=1011)       |
|      Arista#5802      |           [CodePen](https://codepen.io/arista-hsieh/pen/mdLZmbG)            |
|     PayRoom#8328      |            [CodePen](https://codepen.io/water38198/pen/abGgWOw)             |
|       Rice#8043       |       [CodePen](https://codepen.io/riecball/pen/poVXPJj?editors=0011)       |
|      Hilda#7085       |         [CodePen](https://codepen.io/vwquikad-the-vuer/pen/oNdrWwy)         |
|      肉桂卷#0625      |       [CodePen](https://codepen.io/ginnlee/pen/dyeBWNK?editors=0011)        |
|      Loran#1105       |       [CodePen](https://codepen.io/loranlin/pen/YzLoVER?editors=1011)       |
|      Greta#0837       |              [CodePen](https://codepen.io/gretali/pen/dyeBWmg)              |
|       教練#6451       |           [CodePen](https://codepen.io/monkeybear721/pen/YzLoZer)           |
|     jamesccc#6244     | [CodePen](https://codepen.io/nimwnynv-the-sasster/pen/bGMPWKV?editors=1111) |
|   William Lai#0196    |            [CodePen](https://codepen.io/lai-weihan/pen/VwxJbBq)             |
|    Potatolee#7749     |      [CodePen](https://codepen.io/potatoleee/pen/oNdOKxw?editors=0011)      |
|       母湯#7211       |     [CodePen](https://codepen.io/tommyshih77/pen/NWMZjJr?editors=0011)      |
|      黑白兔#0684      |             [CodePen](https://codepen.io/johnny329/pen/MWGMmxv)             |
|     banazita#5143     |       [CodePen](https://codepen.io/banazita/pen/bGMPWQE?editors=1112)       |
|       mou#2215        |     [CodePen](https://codepen.io/shihchiehlan/pen/vYjqZBo?editors=0011)     |
|      kevin#6131       | [CodePen](https://codepen.io/xlqjezvc-the-encoder/pen/PoerjNN?editors=1011) |
|        Rr#2215        |            [Codepen](https://codepen.io/rufangcheng/pen/gOzNgdm)            |
|       萱仔#0781       |      [CodePen](https://codepen.io/ting-hsuan/pen/poVXwor?editors=0010)      |
|       末次#0236       |             [CodePen](https://codepen.io/yunjulee/pen/poVXPwb)              |
|     WEI_RIO#9342      |        [Codepen](https://codepen.io/wei_wu/pen/bGMPRgq?editors=0011)        |
|      Winnie#1306      |    [Codepen](https://codepen.io/WinnieWuWinnie/pen/rNvEwpQ?editors=0011)    |
|      法希娜#3206      | [Codepen](https://codepen.io/yiiserpf-the-encoder/pen/yLjdXKE?editors=1012) |
|       予予#9627       |       [Codepen](https://codepen.io/kiqzcraa/pen/poVXwKK?editors=0012)       |
|      Benson#6763      |             [Codepen](https://codepen.io/kumashow/pen/MWGMoqq)              |
|      魚子醬#5220      |             [CodePen](https://codepen.io/haihsuan/pen/abGgwQg)              |
|    0xWilliam #8796    |           [CodePen](https://codepen.io/0xWilliam0322/pen/dyeBRaG)           |
|    suihsilan#9485     |      [CodePen](https://codepen.io/suihsilan/pen/abGgyob?editors=0010)       |
|       yen#5757        |    [CodePen](https://codepen.io/TZU-HUANG-YEN/pen/oNdPgqY?editors=1011)     |
|       Vera#5592       |              [CodePen](https://codepen.io/skvera/pen/mdLZMrM)               |
|       Rena#6249       |     [Codepen](https://codepen.io/aureate0116/pen/XWqLaPX?editors=1111)      |
|       小白#2406       |            [CodePen](https://codepen.io/gracewhite/pen/jOxjGyb)             |
|     Joy1712#4670      |       [CodePen](https://codepen.io/Joy1712/pen/ZEodXXe?editors=0011)        |
|    出示了阿伯#9923    |     [CodePen](https://codepen.io/BradpittLai/pen/YzLorQJ?editors=1011)      |
popcorn_3q#9893| [CodePen](https://codepen.io/arnyrpqt-the-sasster/pen/PoerJyY?editors=0010)
Yishan#4902| [CodePen](https://codepen.io/gdjrehhw-the-animator/pen/jOxjGvM?editors=0010)
| Chung#5951    | [CodePen](https://codepen.io/yuju16/pen/XWqLzXY?editors=0011)      |
| hayaka #4579  | [CodePen](https://codepen.io/CocoCat/pen/MWGMVaO?editors=0011)     |
| Jenny真#7532  | [CodePen](https://codepen.io/wei-chen-wu/pen/gOzNGLE?editors=0010) |
| yaru#6308     | [Codepen](https://codepen.io/lszaietc/pen/JjvQOpQ?editors=0011)    |
| Fan#3405      | [Codepen](https://codepen.io/Fan123/pen/PoerRoq?editors=1112)      |
| beta lin#1445 | [CodePen](https://codepen.io/linbeta/pen/MWGMrax)                  |
| 鑫鑫#4346     | [CodePen](https://codepen.io/Neil1024/pen/abGgEEN?editors=0011)    |
| RJRS#9430     | [CodePen](https://codepen.io/RJRS/pen/vYjqpde)                     |
|PoWei#8484|[CodePen](https://codepen.io/harrison-wei-lai/pen/YzLoeLd?editors=1111) |
| Ruby Chen#7452 | [CodePen](https://codepen.io/ruby92429/pen/ExLBQww?editors=0011) |
| 王懷英#7271 | [CodePen](https://codepen.io/huaiying/pen/LYmKdmP) |
| 雷雷#7844 | [CodePen](https://codepen.io/lei-yi-jie/pen/OJZevEp?editors=0010) |
| Hironaka#7367 | [CodePen](https://codepen.io/Hironaka0815/pen/rNvEYPR?editors=0011) |
| 蓁心#6229 | [CodePen](https://codepen.io/tlorfrnl-the-typescripter/pen/RwyzyRV?editors=1111) |
| VickyHuang#2918 | [CodePen](https://codepen.io/HSUNA/pen/JjvQvZb?editors=0011) |
| Silvialu#4521 | [CodePen](https://codepen.io/Silvia091640/pen/QWrXrdZ) |
|J_u_d_y#5993|[Codepen](https://codepen.io/J_u_d_y/pen/ExLBLrg?editors=1111)|
|charlottelee849#0366|[Codepen](https://codepen.io/charlotte-lee/pen/YzLovXL?editors=0011)|
|粉蒸肉#6214|[Codepen](https://codepen.io/wrightyu/pen/vYjqrpv?editors=0011)|
| 黃士桓#7654 | [codePen](https://codepen.io/shr-huan-huang/pen/RwyzJeO) |
| 哈囉哈#5196| [CodePen](https://codepen.io/bill0841205/pen/xxjoJEm?editors=1111)
|Sentiments#4883|[codepen](https://codepen.io/Sentiments/pen/RwyzBdG?editors=0011)
|  cbs#9007  |[Codepen](https://codepen.io/wasdjk/pen/jOxjvqe)|
| Evelyne#7323 |[CodePen](https://codepen.io/Evelynep/pen/dyeBqZv)|
| 阿富#0389 |[CodePen](https://codepen.io/spring40747/pen/NWMZErd?editors=0011)|
|竹輪#3335|[CodePen](https://codepen.io/chikuwa0120/pen/ExLBGKY)|
|阿風#6890|[CodePen](https://codepen.io/Afonguwu/pen/RwyzqvR?editors=0010)|
|CofCat#9226|[CodePen](https://codepen.io/cofcat456/pen/YzLoBXa?editors=1011)|
|Mylène#2481|[Codepen](https://codepen.io/hamajibashi/pen/bGMPzQd)|
|Hazel.#6020|[Codepen](https://codepen.io/Hazelhsieh/pen/Vwxowbo?editors=0011)|
|柔柔#1716|[Codepen](https://codepen.io/rouchen/pen/QWreWmq?editors=0011)|
|Amberhh#2465| [Codepen](https://codepen.io/Amberhh/pen/yLjdggv) |
|艸良#2846| [Codepen](https://codepen.io/momoninainai/pen/KKROwyJ?editors=0010) |
|pss940909#8650| [Codepen](https://codepen.io/pss940909/pen/YzLmPjx?editors=0011) |
|Lucie#3831|[Codepen](https://codepen.io/bisespei/pen/QWrewxz)|
|泰泰泰泰#0582|[Codepen](https://codepen.io/tesdzzph-the-bashful/pen/zYjgGyP)|
|CJ07#0176|[codepen](https://codepen.io/cjtseng07/pen/poVMbLp?editors=0012)|
|Cynthia1111#1822|[codepen](https://codepen.io/Cynthia1111/pen/MWGNeNq)|
|Cliff#4606|[Codepen](https://codepen.io/Cliff_hex/pen/OJZYwGz)|
|Cookie SSS#6991|[Codepen](https://codepen.io/sqhjikpa-the-selector/pen/eYrqBNJ?editors=1012)|
|Eileen#6454|[Codepen](https://codepen.io/Eileen-io/pen/Jjvgbzv)|
|黑松胖#4836|[Codepen](https://codepen.io/yi-chien-hsieh/pen/abGepBa?editors=0012)|
|Ryan Chiang#6649|[Codepen](https://codepen.io/ryanchiang/pen/ZEogKRB?editors=0012)|
|Chloe#5422|[CodePen](https://codepen.io/Ironchloe/pen/JjvgJPZ?editors=0010)|
|ssozr#4680|[codepen](https://codepen.io/ssozr/pen/gOzNmmv?editors=0010)|
|Karol-Kuo#5287|[codepen](https://codepen.io/ting-yu-kuo/pen/oNdKeWx?editors=0011)|
|bingsu#2362|[Codepen](https://codepen.io/pmyfr/pen/ExLqEBM?editors=0010)|
|yoyo#1003|[Codepen](https://codepen.io/crpbugqy-the-typescripter/pen/GRdVBOg?editors=1111)|
|Nini Chen#5790|[Codepen](https://codepen.io/ninistyle/pen/vYjozam?editors=0012)|
|Paul#7426|[CodePen](https://codepen.io/paul-1997/pen/yLjmZBm?editors=0011)|
|Tuhacrt#0008|[codepen](https://codepen.io/Tuhacrt/pen/RwyXdYN)|
|ling chang#1024|[codepen](https://codepen.io/ling-chang/pen/xxjvNEg)|
|狸貓#5863|[codepen](https://codepen.io/tanuki320/pen/eYrqaGZ?editors=0010)|
|FiReBrO#0557|[codepen](https://codepen.io/firebro42/pen/rNvXEOG?editors=1112)|
|Jhen#4563|[codepen](https://codepen.io/su-jhen/pen/LYrPPEW)|
|Yuna Huang#2692|[codepen](https://codepen.io/Yuna1002/pen/abKovVj?editors=0011)|
|安o#2448|[Codepen](https://codepen.io/JzhenAn/pen/jOKNyew?editors=1111)|
|Mia小福#4473|[Codepen](https://codepen.io/a0950271/pen/GRGKWQm)|
|YU#0618|[Codepen](https://codepen.io/yoken_/pen/yLEBMvQ)|
|Lou#0085|[Codepen](https://codepen.io/Lusie_H/pen/GRGKxeJ?editors=0011)|
|shio#1414|[Codepen](https://codepen.io/shioyen/pen/mdKbzvG?editors=1111)|
|艾芮絲#6060|[Codepen](https://codepen.io/wangyingju/pen/jOKNQzV)|
|Shuo#1596|[Codepen](https://codepen.io/chiangchungshuo/pen/wvXwROy)|
|健育#5748|[Codepen](https://codepen.io/c1317156/pen/eYKOxJO)|
|RuoAn#7124|[Codepen](https://codepen.io/LiauRuoAn/pen/GRGKeRP?editors=0010)|
|Yiru#0236|[Codepen](https://codepen.io/yiru94/pen/MWXWKaQ?editors=0011)|
|Aritan#1931|[Codepen](https://codepen.io/Aritan/pen/WNyNGYz?editors=1111)|
|DoraHuang#8223|[Codepen](https://codepen.io/mwebwvuq-the-flexboxer/pen/abKbKeJ)|
|Kimi #9564|[Codepen](https://codepen.io/kimihu91/pen/rNKNPwB)|
|芮綺 #5224|[Codepen](https://codepen.io/zhan70/pen/RwJwvYx?editors=0011)|
|christina#6185|[Codepen](https://codepen.io/chrisc0210/pen/wvXvORa)|
|KC_8685#9343|[Codepen](https://codepen.io/cathy7411/pen/LYmKbOB)|
|三隻小貓#1905|[CodePen](https://codepen.io/bagelover/pen/PoaovXB?editors=1111)|
|Judy Wei#6103|[CodePen](https://codepen.io/Judy0718/pen/LYrEPKL)|
|Jamie Wu#9345|[CodePen](https://codepen.io/Wu220103/pen/eYKmzdz)|
|awei#0720|[CodePen](https://codepen.io/Aweishi/pen/BaVyPoG)|
|Cream#3449|[CodePen](https://codepen.io/frxdwbbi-the-sasster/pen/yLEyqXN?editors=0011)|
|sophiee#7015|[Codepen](https://codepen.io/sophiee2727/pen/jOKPdep?editors=1111)|
|Ringo#7583|[Codepen](https://codepen.io/ringolai1988/pen/poKjEdN?editors=0010)|
|阿蘇#8531|[CodePen](https://codepen.io/susu3131/pen/eYKpgjp?editors=0011)|
|郭芙蘭#6374|[CodePen](https://codepen.io/flora_Kuo/pen/jOKbmRp?editors=0011)|
|H.L.C#2152|[CodePen](https://codepen.io/hsin-liang/pen/NWzGagg)|
|yuling#1634|[codepen](https://codepen.io/igzdflpu/pen/QWxjPMb)|
|How#5806|[codepen](https://codepen.io/howtobefine/pen/abKdwve)|
|mei#8421|[codepen](https://codepen.io/Shila-Chen/pen/PoaZgmx?editors=0011)|
|kancheng#3915|[CodePen](https://codepen.io/kancheng/pen/mdKPREE?editors=0011)|
|Azi Hsieh#2861|[CodePen](https://codepen.io/AziHsieh/pen/PoaNdpa)|
|L0F0#8733|[codepen](https://codepen.io/l0f0/pen/gOKLxKx?editors=0011)|
|Sonia Wu#7154|[codepen](https://codepen.io/YUJOU/pen/GRGNLjq?editors=0011)|
|meimei#9524|[codepen](https://codepen.io/isnrudav/pen/NWzvmdm?editors=1011)|
|yuchenye#6119|[codepen](https://codepen.io/yuchen/pen/WNyZbXV)|
|Baozi#2042|[codepen](https://codepen.io/lillianyu/pen/rNKpaLE)|
|samger#0808|[codepen](https://codepen.io/lee-wei-hong/pen/xxzmQzM?editors=1111)|


