---
# System prepended metadata

title: "\U0001F3C5 Day 05 - 賦值運算子與記憶體觀念"
tags: [JS 直播班 - 2023 秋季班]

---

---
tags: JS 直播班 - 2023 秋季班
---
# 🏅 Day 05 - 賦值運算子與記憶體觀念

### 題目

以下兩題請合併為一份 CodePen 繳交，並透過「註解」進行回答。

問題一
---
了解賦值運算子，並計算出最後 console.log 印出的結果
```javascript=
let a = 1;
let b = 2;
a += 30;
a--;
b - 1;
a -= b;

console.log(a);
console.log(b);
```

問題二
---
請說明以下程式碼最後共有幾個記憶體空間
```javascript=
let a = '3';
let b = 3;
let c = a*b;
a + 1;
```

## 回報流程

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

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

<!-- 解答：

問題一：
a: 28
b: 2
（陷阱：b - 1 那行並未賦值，
所以其值並不會帶入 b）

問題二：
5 個

a -> '3'
b -> 3
c -> 9
     1
     '31'
(雖與前題相同未賦值，
但其值仍會被運算後儲存於記憶體中)

補充：若考慮到型別轉換的結果也會佔用一個記憶體空間，那答案會是 7 個
a -> '3'
b -> 3
c -> 3  // 字串3*數字3，過程中會將 字串3 轉型為 數字3
     9
     1
     '1'   
     '31'
-->




回報區
---


|#|     Discord      |                                CodePen / 答案                                |
|:-:|:----------------:|:----------------------------------------------------------------------------:|
|01| xiaokui_71292 | [Codepen](https://codepen.io/pen?template=MWZRJjg)|
|02|阿榮|[Codepen](https://codepen.io/codeitaday/pen/ZEVZLpE?editors=0011)|
|03|pinyi_9|[Codepen](https://codepen.io/Wpypy/pen/PoXgWGa)|
|04|kuanju27|[Codepen](https://codepen.io/Eero-Chiao/pen/RwEOKoQ)|
|05|Zem|[Codepen](https://codepen.io/Potoro/pen/oNJOBLW)|
|06|a_windy|[Codepen](https://codepen.io/pen?template=jOXRyBo)|
|07|runweiting|[Codepen](https://codepen.io/weiting14/pen/NWemdjJ)|
| 08 | santu0868 | [Codepen](https://codepen.io/HatsumiSan/pen/LYMvxWy) |
|09|風羽|[Codepen](https://codepen.io/Joy-Huang/pen/abPxpEp?editors=0010)|
| 10 | 銀光菇 |[CodePen](https://codepen.io/genesynthesis/pen/poqBRyX)|
| 11 | claire |[CodePen](https://codepen.io/yi-wen-chen/pen/poqBRrz)|
| 12 | Ann Chou |[CodePen](https://codepen.io/annchou_illu/pen/qBLwRVj)|
| 13 | Ching |[CodePen](https://codepen.io/tzuchingg/pen/MWZRJQw?editors=0011)|
| 14 | 楓仔 |[CodePen](https://codepen.io/maplestartend/pen/YzdMNea?editors=1112)|
| 15 | Ivy |[CodePen](https://codepen.io/Irene-Ke/pen/NWemdzZ)|
| 16 | 精靈 |[CodePen](https://codepen.io/justafairy/pen/WNLWRYe?editors=0010)|
| 17 | Peng |[CodePen](https://codepen.io/H-Peng/pen/LYMvxge?editors=0010)|
| 18 | shiang |[CodePen](https://codepen.io/Bo-Shiang/pen/mdagWyv?editors=1112)|
| 19 | Luna |[CodePen](https://codepen.io/sfctsolp-the-sasster/pen/zYyXZvE?editors=0010)|
| 20 | kawa |[CodePen](https://codepen.io/z83xji6/pen/RwEOpGd?editors=0010)
| 21 | MDFK |[CodePen](https://codepen.io/maywang/pen/vYvMxLv)
|22| Moreene |[CodePen](https://codepen.io/Moreene/pen/vYvMxyP)|
| 23 | tanuki5863 | [CodePen](https://codepen.io/tanuki320/pen/WNLWppw?editors=1010) |
| 24 | Alyce | [CodePen](https://codepen.io/alycehwy/pen/QWzPpvE?editors=0010) |
| 25 | ShangChu | [CodePen](https://codepen.io/shangchu0412/pen/oNJOZWQ?editors=0010)
| 26 | Allen | [CodePen](https://codepen.io/hlctw/pen/WNLWpZx)
| 27 | Helen | [CodePen](https://codepen.io/milkteamonster/pen/wvRZJPM?editors=0010)
| 28 | jiayu | [CodePen](https://codepen.io/fjqxaznl-the-reactor/pen/RwEOpBb?editors=0010)
| 29 | Winnie | [CodePen](https://codepen.io/codepen-io-winnie/pen/eYbovjV?editors=0010) |
| 30 | Zhu | [CodePen](https://codepen.io/codepenplayer/pen/NWempLb) |
| 31 | 保羅 | [CodePen](https://codepen.io/paul-1997/pen/KKbYWYX?editors=0010)|
| 32 | yuling | [CodePen](https://codepen.io/igzdflpu/pen/vYvMxMY) |
| 33 | CPing | [CodePen](https://codepen.io/CPing/pen/yLGrMdv) |
| 34 | 蛋塔 | [CodePen](https://codepen.io/Hong-Game1/pen/vYvMmEO) |
| 35 | yuan! | [CodePen](https://codepen.io/townyuan/pen/QWzPvbq) |
| 36 | Daylily | [CodePen](https://codepen.io/daylily/pen/YzdMVKz) |
| 37 | ChrisSQR | [CodePen]([網址](https://codepen.io/ChrisSQR/pen/jOXRmVZ?editors=1010)) |
| 38 | 詹姆士 | [CodePen]([網址](https://codepen.io/z111048/pen/eYboWEb)) |
| 39 | Oria |[CodePen](https://codepen.io/kajing/pen/abPxWKo?editors=0011) |
| 40 | 小夏 |[CodePen](https://codepen.io/michaelhsia/pen/ExGJmEq) |
| 41 | 凱恩 |[CodePen](https://codepen.io/Royen0506/pen/MWZRmQZ?editors=1111) |
| 42 | ann6212 |[CodePen](https://codepen.io/yqmegupa-the-styleful/pen/MWZRmPx?editors=1111) |
| 43 | cest_jessie | [CodePen](https://codepen.io/itsjessiechen/pen/bGOJWZK) |
| 44 | Chia Pin | [CodePen](https://codepen.io/joker-cat/pen/NWemgqO) |
| 45 | Ataraxia | [CodePen](https://codepen.io/ataraxia8888/pen/vYvpQdM) |
| 46 | dora | [CodePen](https://codepen.io/dorayu/pen/vYvMmeK?editors=1010) |
| 47 | Lychee KK | [CodePen](https://codepen.io/kakakala/pen/vYvMZed) |
| 48 | phyllis_0802 | [CodePen](https://codepen.io/Phyllis-Cheng/pen/eYboRKZ) |
| 49 | minnielin | [CodePen](https://codepen.io/ShengXin-Lin/pen/vYvMZoV?editors=1011) |
| 50 | Lainie1931 | [CodePen](https://codepen.io/Lainie88/pen/abPxwpm) |
| 51 | Peggy | [CodePen](https://codepen.io/peggylai/pen/eYboEYv?editors=1010) |
| 52 |      Jerry | [CodePen](https://codepen.io/ildkosxk-the-encoder/pen/mdagMOg) |
| 53 | Uli | [CodePen](https://codepen.io/uli1313/pen/mdagMqN?editors=1011) |
| 54 | SHUO | [CodePen](https://codepen.io/xrzarxkl-the-reactor/pen/abPXoXJ?editors=1111)|
| 55 | ⭐️小正 | [CodePen](https://codepen.io/colorgolden/pen/KKbYXwZ)|
| 56| OSN | [CodePen](https://codepen.io/osncodepen/pen/jOXRLXw) 
| 57 | ming0712 | [CodePen](https://codepen.io/StevenHuang/pen/MWZREeX?editors=0010)|
| 58 | Ccccc | [CodePen](https://codepen.io/CyreneTsai/pen/OJrGOVZ?editors=1112)|
| 59 | Sean Chang | [CodePen](https://codepen.io/windfantasy4/pen/vYvMWJd)
| 60 | shawey.1a2b | [Codepen](https://codepen.io/Shawey/pen/LYMverM) |
| 61 | Yijing | [CodePen](https://codepen.io/Yi-Jing-71080635/pen/BavEJOj?editors=1111) |
| 62 | sunny_08149 | [Codepen](https://codepen.io/Sunny-Lin/pen/bGOJaZB) |
| 63 | 白熊 | [Codepen](https://codepen.io/WhiteBearChen/pen/ZEVZrbR?editors=0011) |
| 64 | Eden | [Codepen](https://codepen.io/iseden/pen/LYMvQYo)|
| 65 | Jun_ | [Codepen](https://codepen.io/Jun-L/pen/qBLwxmW)|
| 66 | MY | [Codepen](https://codepen.io/ahmomoz/pen/PoXgQEm)|
| 67 | LinaChen | [Codepen](https://codepen.io/LinaChen/pen/JjwVpOP)|
| 68 | gebyman | [Codepen](https://codepen.io/gebyman/pen/xxmeYro)|
| 69 | 荷菓かのり | [CodePen](https://codepen.io/oogxwkvw-the-builder/pen/GRPLdra?editors=0012) |
| 70 | Befun | [CodePen](https://codepen.io/richard260572/pen/WNLWJao?editors=1111) |
| 71 | Fia | [CodePen](https://codepen.io/HHH_Ten/pen/wvRZXeq?editors=0010) |
| 72 | nini1202desu | [CodePen](https://codepen.io/tvxq5206/pen/KKbYeQe?editors=0011) |
| 73 | 依依| [CodePen](https://codepen.io/Rita-Yang/pen/gOZyjpo?editors=1010) |
| 74 | hsiu8767 | [CodePen](https://codepen.io/hsiu8767/pen/GRPLGXm?editors=0010) |
| 75 | jimmy.0706 | [CodePen](https://codepen.io/WeiJun-Mao/pen/QWzPBqP) |
| 76 | yu.t_liu | [CodePen](https://codepen.io/YuT200053/pen/WNLWKMW?editors=0010) |
| 77 | swalok47716 | [Codepen](https://codepen.io/swalok/pen/VwqNBVX?editors=0012) |
| 78 | celinelinnn |[Codepen](https://codepen.io/celinephoebe/pen/WNLWKKq)|
| 79 | Hank._.z |[Codepen](https://codepen.io/linoiaby-the-sans/pen/GRPLXKP)|
| 80 | 維哲 | [CodePen](https://codepen.io/kwz1202/pen/OJrGoVY)|
| 81 | JUNEW | [CodePen](https://codepen.io/June-W/pen/xxmemZp)|
| 82 | Mattie | [CodePen](https://codepen.io/mattielin/pen/JjwVwQw)|
|83|Joy-chiang|[codepen](https://codepen.io/fwysphbw-the-vuer/pen/ZEVZayY)|
| 84 | shcopy | [CodePen](https://codepen.io/shcopy/pen/bGOJvNj) |
| 85 | (奔跑吧)GTR150 | [CodePen](https://codepen.io/Wer-Qwe/pen/PoXgvPz?editors=1111) |
| 86 | shuuu | [CodePen](https://codepen.io/afjrvjzl-the-bashful/pen/dywLEKY?editors=1111) |
| 87 | 一畫 | [CodePen](https://codepen.io/YH-K-the-selector/pen/OJrGYQm)) |
| 88 | Iris | [CodePen](https://codepen.io/iris831206/pen/XWoQwvv) |
| 89 | xin | [CodePen](https://codepen.io/Estherrrrrr999/pen/poqBXBJ) |
| 90 | skypassion5000 | [CodePen](https://codepen.io/skypassion5000/pen/jOXRjjO?editors=0011) |
| 91 | 白夜 | [CodePen](https://codepen.io/Wei903/pen/WNLBewO?editors=1111) |
| 92 | Andy | [CodePen](https://codepen.io/andy31342/pen/ExGzYWr?editors=1111) |
| 93 | Rxzan | [CodePen](https://codepen.io/Tzuru-Chen/pen/mdaYdOq) |
| 94 | skylaaaa | [CodePen](https://codepen.io/chihyu2790/pen/NWeVPdP) |
| 95 | shiro | [CodePen](https://codepen.io/chenghsienwang/pen/gOZJbBO) |
| 96 | hsuanlee1084 | [CodePen](https://codepen.io/hsuanlee1024/pen/oNJRXgR?editors=0010) |
| 97 | TTedd | [CodePen](https://codepen.io/TTedd/pen/rNogxKY?editors=1010) |
| 98 | neo_1104 | [CodePen](https://codepen.io/eipakoeq-the-animator/pen/MWZdjOp) |
| 99 | hsu0921 | [CodePen](https://codepen.io/uli1313/pen/mdagMqN?editors=1011) |
| 100 | Tina02 | [CodePen](https://codepen.io/chjitlox-the-bashful/pen/vYvwxEa) |
| 101 | QOO | [CodePen](https://codepen.io/QOOQOOQ/pen/LYMvyxY?editors=0012) |
| 102 | Fabio20 | [CodePen](https://codepen.io/fabio7621/pen/VwqOpVg?editors=0010) |
| 103 | xuan | [CodePen](https://codepen.io/pen/?editors=0012) |
| 104 | jojo2824 | [CodePen](https://codepen.io/joanne-wei/pen/poqmPdL?editors=0011) |
| 105 | yin | [CodePen](https://codepen.io/andy888jam/pen/WNLBEOv?editors=1111) |
| 106 | 皆順#1616 | [CodePen](https://codepen.io/koba60052ww/pen/dywEVLG?editors=0010) | 
| 107 | 郭芙蘭#6374| [CodePen](https://codepen.io/flora_Kuo/pen/VwqOyax?editors=1111) | 
| 100 | rogan6517 | [CodePen](https://codepen.io/RoganHsu/pen/gOZyVdO?editors=0010) |
| 101 | damon0323 | [CodePen](https://codepen.io/swk9eny2/pen/ExGzQMB?editors=0010) |
| 102 | JasonFu | [CodePen](https://codepen.io/jie-Fu/pen/QWzRxOq) |
| 103 | kebukeyi | [CodePen](https://codepen.io/kebukeyi/pen/wvRbRgL) |
| 104 | Vivian2857 | [CodePen](https://codepen.io/uojbohed-the-solid/pen/mdaYobR?editors=0110) |
| 105 | 小廷 | [CodePen](https://codepen.io/uyxkiake-the-selector/pen/gOZNOOW?editors=0010) |
| 106 | Noah | [CodePen]([網址](https://codepen.io/lch1222/pen/NWeZPRZ)) |
| 107 | patrickpie | [CodePen](https://codepen.io/patrickpie/pen/KKbLLRZ) |
| 108 | judy123 | [CodePen](https://codepen.io/tsong-h/pen/vYvqxKj?editors=1111) |
| 109 | yaoling.liang | [CodePen](https://codepen.io/Yao-Ling-L-/pen/KKbjmam?editors=1111) |
| 110 | ss585801 |[CodePen](https://codepen.io/ss585801/pen/vYvqJMb)
| 111 | yuan2781 | [CodePen](https://codepen.io/ismebir/pen/MWZMrqj) |
| 112 | 阿賀#3700 | [CodePen](https://codepen.io/sungho/pen/jOXjBbg) |
| 113 | 地球儀 | [CodePen](https://codepen.io/dayday1222/pen/YzdoLKr?editors=0010) |
| 114 | cosmos7755 | [CodePen](https://codepen.io/violet7755/pen/qBLNXdW) |
| 115 | Jeff | [CodePen](https://codepen.io/nonwaaa/pen/poqMJbR) |
| 116 | PH | [CodePen](https://codepen.io/lokf9527/pen/bGOXxrO?editors=1111) |
| 117 | RX00 | [CodePen](https://codepen.io/llqzknqv-the-styleful/pen/dywxQZo?editors=0010) |
| 118 | davidtt | [CodePen](https://codepen.io/David-Tsai/pen/ExGqqWP?editors=0011) |
| 119 | 歐陽龍龍#1061 | [CodePen](https://codepen.io/dizzydog-rgb/pen/BaMByvM) |
| 120 | 阿維#2569 | [CodePen](https://codepen.io/iijojpli-the-looper/pen/PoVYOaW?editors=0010) |
| 130 | 辣椒 | [Codepen](https://codepen.io/chilichen118/pen/XWOrVPX) |
| 131 | nikkita_3544 | [CodePen](https://codepen.io/vanessa7259/pen/dyaYvRE?editors=0010)|
| 132 | ssshane | [CodePen](https://codepen.io/sam6091260/pen/dyaMQyM?editors=1010)|
| 133 | Martin | [CodePen](https://codepen.io/markyourpage/pen/KKJMBpR) |
| 134 | Rochel | [Codepen](https://codepen.io/rochelwang1205/pen/LYqyzoz?editors=1111)|
| 135 | MaciHuang | [Codepen](https://codepen.io/macy1215/pen/KKJRMNa?editors=0010)|
| 136 | bf_tsai | [CodePen](https://codepen.io/BF-Tsai/pen/QWYBoXy) |
| 137 | NathanJames | [CodePen](https://codepen.io/ufo060204/pen/XWOPzLR) |

<!-- 快速複製




| 順序 | 名稱 | [CodePen](網址) |

-->