---
# System prepended metadata

title: "\U0001F3C5 Day 16 - 函式觀念一"
tags: [JS 直播班 - 2022 秋季班]

---

---
tags: JS 直播班 - 2022 秋季班
---
# 🏅 Day 16 - 函式觀念一

依照下方教學練習，並回答問題。

### 基本函式寫法教學 
[課程影音連結](https://courses.hexschool.com/courses/202011131/lectures/42391122)

1. 宣告、命名函式
```javascript=
// 在此 morningAction 是自定義的名稱
function morningAction() {
  // 定義函式執行內容
  console.log("刷牙");
  console.log("洗臉");
} 
```
2. 呼叫函式
```javascript=
morningAction();
morningAction();
```
> 1. 函式撰寫完後，需要呼叫才會執行
> 2. 函式可以重複呼叫

問題
---
1. 宣告一個函式，讓此函式執行後會印出字串 `"這是一個函式"`
2. 觀看下方程式碼，最後會印出什麼
```javascript=
function sayHello() {
  console.log("ㄋ好");
}
console.log("Bye！");
```
3. 觀看下方程式碼，選出正確敘述
```javascript=
function sayHi() {
  console.log("Hi");
}
sayHi();
sayHi();

/* 選項 
   1. 函式不能重複呼叫，會報錯
   2. 最後會印出兩個 Hi
   3. 只會執行一次，印出一個 Hi
*/
```

## 回報流程

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

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

<!-- 解答：  

1. 函式名稱可以隨意命名，盡量與執行內容相符即可
```
function printString() {
  console.log("這是一個函式");
}
printString();  // 記得呼叫才會執行
```

2. Bye！
3. 選項 2
-->




回報區
---


|       Discord        |                                  CodePen / 答案                                  |
|:--------------------:|:--------------------------------------------------------------------------------:|
|    masterYan#2480    |          [CodePen](https://codepen.io/htzwgoqt-the-looper/pen/QWxLzEq)           |
|       YC#2522        |                  [CodePen](https://codepen.io/YCLu/pen/ZERzXoQ)                  |
|       VT#0895        |                 [Codepen](https://codepen.io/vt197/pen/abKoLjW)                  |
|     PayRoom#8328     |               [CodePen](https://codepen.io/water38198/pen/zYaOELN)               |
|    banazita#5143     |                [CodePen](https://codepen.io/banazita/pen/dyKbVKJ)                |
|     法希娜#3206      |   [CodePen](https://codepen.io/yiiserpf-the-encoder/pen/GRGKMBY?editors=1111)    |
|      Data#9297       |               [CodePen](https://codepen.io/kirakira72/pen/gOKYGBQ)               |
|      yumy#1940       |               [CodePen](https://codepen.io/yumy_yamg/pen/VwdZMBX)                |
|      albee#9121      |        [Codepen](https://codepen.io/albee-chang/pen/oNyvGQE?editors=1012)        |
|      Ayre#0016       |        [Codepen](https://codepen.io/yichunlin09/pen/MWXgExe?editors=0010)        |
|     IreneY#0086      |           [codepen](https://codepen.io/HalfPlannedJourney/pen/MWXgERe)           |
|     魚子醬#5220      |                [CodePen](https://codepen.io/haihsuan/pen/bGKboZX)                |
|      薯餅#3581       |             [CodePen](https://codepen.io/ColdingPoTaTo/pen/vYrBeMz)              |
|      Chung#5951      |          [CodePen](https://codepen.io/yuju16/pen/LYrPzKd?editors=0010)           |
|     Benson#6763      |                [Codepen](https://codepen.io/kumashow/pen/xxzKXvP)                |
|      Clara#1275      |         [Codepen](https://codepen.io/bsupixqu/pen/QWxLqeb?editors=1012)          |
|    kenki100#0068     |                 [codepen](https://codepen.io/ken100/pen/ZERzaYL)                 |
|      RJRS#9430       |                  [CodePen](https://codepen.io/RJRS/pen/XWYrzma)                  |
|     WEI_RIO#9342     |          [CodePen](https://codepen.io/wei_wu/pen/MWXgOJm?editors=0011)           |
|    LHchien33#6232    |         [CodePen](https://codepen.io/lin_chien/pen/poKzdRN?editors=0010)         |
|       YI#0863        |          [CodePen](https://codepen.io/YI0305/pen/jOKNamM?editors=0012)           |
|      無名#6427       |          [CodePen](https://codepen.io/Nomoney/pen/ZERzaKy?editors=0011)          |
|     AuroraC#6539     |          [codepen](https://codepen.io/AuroraC/pen/YzvKEQg?editors=0010)          |
|   hsiung阿熊#4079    |               [Codepen](https://codepen.io/hsiungchi/pen/BaVBmZy)                |
|      小白#2406       |               [CodePen](https://codepen.io/gracewhite/pen/LYrPOyJ)               |
|       m_m#5493       |               [CodePen](https://codepen.io/minnn7716/pen/JjZPONZ)                |
|      Tami#6742       |     [CodePen](https://codepen.io/wqsdqbjn-the-vuer/pen/yLEBPzb?editors=0010)     |
|      Rice#8043       |         [CodePen](https://codepen.io/riecball/pen/yLEBPpX?editors=0010)          |
|   KatyChiang#1554    |          [CodePen](https://codepen.io/Kai0819/pen/RwJbjQz?editors=0010)          |
|    JustinLiu#9699    |        [CodePen](https://codepen.io/justin0227/pen/ExRYbER?editors=0011)         |
|     Tuhacrt#0008     |                [codepen](https://codepen.io/Tuhacrt/pen/zYaOPjj)                 |
|      教練#6451       |             [codepen](https://codepen.io/monkeybear721/pen/zYaOPLa)              |
|      yawun#0042      |               [CodePen](https://codepen.io/monicalin/pen/JjZPOLm)                |
|      amy芳#1385      |               [CodePen](https://codepen.io/amy-chieng/pen/ExRYbOe)               |
|     hungya#0773      |         [CodePen](https://codepen.io/hungya777/pen/JjZPOae?editors=0010)         |
|      威爾#1694       |                [CodePen](https://codepen.io/WILL_Wu/pen/VwdZrrR)                 |
|     CofCat#9226      |         [CodePen](https://codepen.io/cofcat456/pen/NWzKwJd?editors=1111)         |
|    shinyhung#3825    |         [CodePen](https://codepen.io/sean_1215/pen/bGKbYXq?editors=0010)         |
|     bingsu#2362      |                 [CodePen](https://codepen.io/pmyfr/pen/BaVBmXQ)                  |
|      homer#1525      |                [CodePen](https://codepen.io/Buckhorn/pen/poKzdGW)                |
|   jacky010080#0880   |       [CodePen](https://codepen.io/Yen-Jung-Chen/pen/JjZPOgz?editors=0010)       |
|      母湯#7211       |        [CodePen](https://codepen.io/tommyshih77/pen/vYrBpYE?editors=0011)        |
|      kuku#3118       |              [Codepen](https://codepen.io/mengting-ku/pen/yLEBpYK)               |
|      JackC#0411      |                [CodePen](https://codepen.io/key0329/pen/dyKbJYb)                 |
|      狸貓#5863       |         [CodePen](https://codepen.io/tanuki320/pen/MWXgrwG?editors=0010)         |
|     Hazel.#6020      |        [CodePen](https://codepen.io/Hazelhsieh/pen/gOKYGdQ?editors=0011)         |
|     Mylène#2481      |              [Codepen](https://codepen.io/hamajibashi/pen/XWYrVNo)               |
|    mandylai#4055     |              [Codepen](https://codepen.io/mandy-lai-2/pen/KKePZWR)               |
|      柔柔#1716       |          [Codepen](https://codepen.io/rouchen/pen/gOKYoKR?editors=0011)          |
|       cbs#9007       |          [Codepen](https://codepen.io/wasdjk/pen/LYrPerp?editors=1111)           |
|      Lucie#3831      |                [Codepen](https://codepen.io/bisespei/pen/VwdZrpq)                |
|      Loran#1105      |         [Codepen](https://codepen.io/loranlin/pen/vYrBpPx?editors=1111)          |
|     Judy☻ #7874      |         [CodePen](https://codepen.io/hsiaohan/pen/abKoExO?editors=1010)          |
|     楓之聲#6945      |               [Codepen](https://codepen.io/sshane258/pen/bGKbaJK)                |
|     Winnie#1306      |      [Codepen](https://codepen.io/WinnieWuWinnie/pen/OJELzYQ?editors=0010)       |
|     SASIMI#5099      |              [Codepen](https://codepen.io/sashimi1327/pen/yLjxoKw)               |
|       威0#6919       |        [Codepen](https://codepen.io/n0918679182/pen/yLEBpmr?editors=0012)        |
|      末次#0236       |                [Codepen](https://codepen.io/yunjulee/pen/ZERzrEg)                |
|    Ruby Chen#7452    |         [Codepen](https://codepen.io/ruby92429/pen/gOKYvwz?editors=1111)         |
|      Greta#0837      |                [CodePen](https://codepen.io/gretali/pen/OJELQOB)                 |
| charlottelee849#0366 |       [Codepen](https://codepen.io/charlotte-lee/pen/ZERzrxb?editors=0011)       |
|   出事了阿伯#9923    |        [Codepen](https://codepen.io/BradpittLai/pen/oNyvEap?editors=1010)        |
|    Potatolee#7749    |        [Codepen](https://codepen.io/potatoleee/pen/wvXwKJK?editors=0011)         |
|      大衛#4869       |         [Codepen](https://codepen.io/exnsrpjc/pen/XWYrZYj?editors=1011)          |
|    suihsilan#9485    |         [Codepen](https://codepen.io/suihsilan/pen/wvXwmda?editors=0010)         |
|     心幻羽#0056      |        [Codepen](https://codepen.io/linglingsyu/pen/vYrBRKv?editors=1111)        |
|     哈囉哈#5196      |        [CodePen](https://codepen.io/bill0841205/pen/XWYrEzV?editors=1011)        |
|     DaisyLi#4231     |    [CodePen](https://codepen.io/lidairong-gmail-com/pen/poKzLWe?editors=0012)    |
|     君Jyun#0147      |         [codepen](https://codepen.io/Okaybeok/pen/bGKbvMp?editors=0010)          |
|      Cliff#4606      |               [Codepen](https://codepen.io/Cliff_hex/pen/MWXgVqO)                |
|     cotton#7163      |          [Codepen](https://codepen.io/cottonT/pen/dyKbmma?editors=0010)          |
|      Peng#9811       |                [Codepen](https://codepen.io/peng-027/pen/LYrPdvv)                |
|   Cookie SSS#6991    |   [Codepen](https://codepen.io/sqhjikpa-the-selector/pen/yLEBjLv?editors=1012)   |
|    Hironaka#7367     |       [Codepen](https://codepen.io/Hironaka0815/pen/VwdZxjY?editors=0010)        |
|      圈圈#4060       |     [Codepeb](https://codepen.io/wjejfczn-the-bold/pen/gOKYzMw?editors=1111)     |
|    beta lin#1445     |                [CodePen](https://codepen.io/linbeta/pen/RwJbyZR?)                |
|      Ohno#1144       |         [Codepen](https://codepen.io/mmaa7850/pen/rNKBvJR?editors=0011)          |
|      雷雷#7844       |        [Codepen](https://codepen.io/lei-yi-jie/pen/abKoGqe?editors=0010)         |
|     FiReBrO#0557     |         [Codepen](https://codepen.io/firebro42/pen/MWXgXYd?editors=1111)         |
|    我是泇吟#5189     |                [CodePen](https://codepen.io/kljuqbxs/pen/yLEBEOd)                |
|    jimmyFang#9575    |         [CodePen](https://codepen.io/pohxiqqo/pen/ExRYRXy?editors=0011)          |
|      Paul#7426       |         [CodePen](https://codepen.io/paul-1997/pen/XWYrBaz?editors=0011)         |
|     Amberhh#2465     |                [Codepen](https://codepen.io/Amberhh/pen/LYrPOjg)                 |
|      鑫鑫#4346       |         [CodePen](https://codepen.io/Neil1024/pen/rNKBZVZ?editors=0010)          |
|   jackson204#6363    |                 [CodePen](https://codepen.io/pen/?editors=1111)                  |
|      azami#5986      |                  [CodePen](https://codepen.io/azami/pen/abGrXV)                  |
|      萱仔#0781       |        [CodePen](https://codepen.io/ting-hsuan/pen/OJELoYz?editors=0011)         |
|     RayChen#6088     |              [CodePen](https://codepen.io/raychen1996/pen/ExRYdjj)               |
|     王懷英#7271      |                [CodePen](https://codepen.io/huaiying/pen/mdKbzVq)                |
|       yen#5757       |             [CodePen](https://codepen.io/TZU-HUANG-YEN/pen/bGoBeOd)              |
|       安o#2448       |                [CodePen](https://codepen.io/JzhenAn/pen/mdKbzjj)                 |
|      yoyo#1003       |       [CodePen](https://codepen.io/crpbugqy-the-typescripter/pen/vYrBQLQ)        |
|      Rena#6249       |        [Codepen](https://codepen.io/aureate0116/pen/RwJbqEb?editors=1011)        |
|    泰泰泰泰#0582     |   [Codepen](https://codepen.io/tesdzzph-the-bashful/pen/vYrBvYY?editors=0011)    |
|     艾芮絲#6060      |        [Codepen](https://codepen.io/wangyingju/pen/MWXgZwV?editors=0011)         |
|       mou#2215       |       [Codepen](https://codepen.io/shihchiehlan/pen/abKoPxz?editors=0011)        |
|   Ryan Chiang#6649   |        [Codepen](https://codepen.io/ryanchiang/pen/ExRYdXy?editors=0012)         |
|     黃士桓#7654      |             [codePen](https://codepen.io/shr-huan-huang/pen/PoaYVWe)             |
|      健育#5748       |                [codePen](https://codepen.io/c1317156/pen/VwdZgbz)                |
|      蓁心#6229       | [codePen](https://codepen.io/tlorfrnl-the-typescripter/pen/GRGKegz?editors=1011) |
|      竹輪#3335       |              [codePen](https://codepen.io/chikuwa0120/pen/rNKBRem)               |
|    hannahTW#2224     |         [codePen](https://codepen.io/hangineer/pen/BaVBbVo?editors=1112)         |
|      RuoAn#7124      |         [codePen](https://codepen.io/LiauRuoAn/pen/poKzBKO?editors=0010)         |
|      予予#9627       |         [codePen](https://codepen.io/kiqzcraa/pen/RwJwWJm?editors=0011)          |
|     CloThEs#7837     |                [codePen](https://codepen.io/CloThEsZ/pen/RwJwWym)                |
|     yoshidc#0455     |                [CodePen](https://codepen.io/yoshiyyc/pen/yLELeBP)                |
|      #Yiru0236       |          [Codepen](https://codepen.io/yiru94/pen/vYrYLrK?editors=0011)           |
|      Hilda#7085      |           [Codepen](https://codepen.io/vwquikad-the-vuer/pen/PoeMqxM)            |
|      艸良#2846       |       [Codepen](https://codepen.io/momoninainai/pen/LYrYNLx?editors=0010)        |
|   Cynthia1111#1822   |              [Codepen](https://codepen.io/Cynthia1111/pen/yLELOGy)               |
|       Rr#2215        |              [Codepen](https://codepen.io/rufangcheng/pen/xxzxEpN)               |
|     黑白兔#0684      |               [Codepen](https://codepen.io/johnny329/pen/bGKGeYd)                |
|     肉桂卷#0625      |          [Codepen](https://codepen.io/ginnlee/pen/GRGRjQj?editors=0012)          |
|      Powei#8484      |     [Codepen](https://codepen.io/harrison-wei-lai/pen/wvXvzXq?editors=1111)      |
|    Ron Liang#7277    |                 [Codepen](https://codepen.io/ron-go/pen/YzvzGRW)                 |
|      k.sin#3115      |          [codePen](https://codepen.io/sin588/pen/ExRxNYY?editors=0011)           |
| Rr#2215                     |       [Codepen](https://codepen.io/rufangcheng/pen/xxzxEpN)                                                                           |
|   勁辣雞腿寶#5817    |         [CodePen](https://codepen.io/orz311013/pen/bGKGBzZ?editors=1011)         |
|     Yuna Huang#2692      |              [codePen](https://codepen.io/Yuna1002/pen/dyKyWvv?editors=0010) |
|   shio#1414     |              [codePen](https://codepen.io/pen/?editors=1111) |
|ling chang#1024|[codePen](https://codepen.io/ling-chang/pen/poKoWEG) |
|DoraHuang#8223| [CodePen](https://codepen.io/mwebwvuq-the-flexboxer/pen/QWxWBPK)|
|Wei#2330|[Codepen](https://codepen.io/ixfjxrbo-the-typescripter/pen/poKoqLL)|
|Kimi #9564|[Codepen](https://codepen.io/kimihu91/pen/ExRxryx)|
|Tami#6742|[CodePen](https://codepen.io/wqsdqbjn-the-vuer/pen/yLEBPzb)|
|RyanTsai#8906|[CodePen](https://codepen.io/linlaose/pen/wvXvNrX)
|芮綺#5224|[CodePen](https://codepen.io/zhan70/pen/bGKGZEy?editors=0011)|
|KC_8685#9343|[Codepen](https://codepen.io/cathy7411/pen/ZERzobR)|
|三隻小貓#1905|[CodePen](https://codepen.io/bagelover/pen/poKoXbJ?editors=1010)|
|Yishan#4902|[CodePen](https://codepen.io/gdjrehhw-the-animator/pen/OJEJewK?editors=0011)|
|Judy Wei#6103|[CodePen](https://codepen.io/Judy0718/pen/oNygNbo)|
|黑松胖#4836|[Codepen](https://codepen.io/yi-chien-hsieh/pen/YzvPXzW?editors=0012)|
|Silvialu#4521|[Codepen](https://codepen.io/Silvia091640/pen/rNKaxOJ)|
|Jamie Wu#9345|[Codepen](https://codepen.io/Wu220103/pen/gOKbwYY)|
|awei#0720|[Codepen](https://codepen.io/Aweishi/pen/WNybdXp)|
popcorn_3q#9893|[Codepen](https://codepen.io/arnyrpqt-the-sasster/pen/BaVyVod?editors=0011)|
|Cream#3449|[Codepen](https://codepen.io/frxdwbbi-the-sasster/pen/poKvZqb?editors=0011)|
|jin.huang#4666|[Codepen](https://codepen.io/haha1196/pen/wvXBOPZ?editors=1010)|
|christina#6185|[Codepen](https://codepen.io/chrisc0210/pen/dyKPEvG)|
|Mia小福#4473|[Codepen](https://codepen.io/a0950271/pen/rNKagWR)|
|J_u_d_y#5993|[Codepen](https://codepen.io/J_u_d_y/pen/abKzrPv)|
|阿風#6890|[Codepen](https://codepen.io/Afonguwu/pen/qBKERNX)|
|Eileen#6454|[Codepen](https://codepen.io/Eileen-io/pen/dyKozxx)|
|yaru#6308|[codepen](https://codepen.io/lszaietc/pen/NWzPZxo)|
|Kevin#6131|[codepen](https://codepen.io/xlqjezvc-the-encoder/pen/qBKdgwb?editors=1011)|
|sophiee#7015|[Codepen](https://codepen.io/sophiee2727/pen/RwJPvmV?editors=1111)
|富#0389|[Codepen](https://codepen.io/spring40747/pen/PoaqvYN?editors=1112)
|YU#0618|[Codepen](https://codepen.io/yoken_/pen/eYKpzbJ)|
|Chloe#5422|[Codepen](https://codepen.io/Ironchloe/pen/YzvyxXv?editors=0010)|
|Ringo#7583|[Codepen](https://codepen.io/ringolai1988/pen/wvXKqmB?editors=1010)|
|Jhen#4563|[Codepen](https://codepen.io/su-jhen/pen/xxzwLmJ)|
|Shuo#1596|[Codepen](https://codepen.io/chiangchungshuo/pen/vYrNeJO)|
|郭芙蘭#6374|[Codepen](https://codepen.io/flora_Kuo/pen/OJEyObv?editors=0011)|
|Velma#1693|[Codepen](https://codepen.io/Ze1225/pen/zYarZJd?editors=0010)|
|yuling#1634|[codepen](https://codepen.io/igzdflpu/pen/OJEMvXj)|
|How#5806|[codepen](https://codepen.io/howtobefine/pen/OJEMore)|
|mei#8421|[codepen](https://codepen.io/Shila-Chen/pen/WNyrBww?editors=0010)|
|kancheng#3915|[CodePen](https://codepen.io/kancheng/pen/yLEOgKQ)|
|Nini Chen#5790|[CodePen](https://codepen.io/ninistyle/pen/abKNqaa?editors=0011)|
|阿蘇#8531|[CodePen](https://codepen.io/susu3131/pen/xxzVzyy?editors=0011)||
|軟綿綿 (๑•ᴗ•๑) ♡#3627|[CodePen](https://codepen.io/Connie-Chien/pen/ZERWjzo?editors=0011)|
|Azi Hsieh#2861|[CodePen](https://codepen.io/AziHsieh/pen/NWzNOKK)|
|L0F0#8733|[CodePen](https://codepen.io/l0f0/pen/YzvpxoV?editors=0011)|
|大大#5164|[CodePen](https://codepen.io/gzonothk-the-looper/pen/mdKRVWP?editors=1012)|
|H.L.C#2152|[Codepen](https://codepen.io/hsin-liang/pen/gOKRpGL)
|meimei#9524|[Codepen](https://codepen.io/isnrudav/pen/mdKMYae)
|yuchenye#6119|[Codepen](https://codepen.io/yuchen/pen/PoaJPqW)
|Baozi#2042|[Codepen](https://codepen.io/lillianyu/pen/BaVJarp)
|pss940909#8650|[Codepen](https://codepen.io/pss940909/pen/YzvYgWM?editors=1011)
|pss940909#8650|[Codepen](https://codepen.io/pss940909/pen/YzvYgWM?editors=1011)
|samger#0808|[Codepen](https://codepen.io/lee-wei-hong/pen/XWYooEr?editors=1111)
|Paul#7426|[CodePen](https://codepen.io/paul-1997/pen/XWYrBaz)|


