助教天團
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Help
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
--- tags: 30 天軟體工程師體驗營|2025 --- > 建議觀看的影音章節: > JS - 流程判斷 - if、else if、else > JS - if 流程圖規劃流程 > JS - if 中階運用 # 🏅 JS 任務 Day7 - if 流程判斷 III ### 題目一:有沒有打折 某廠商大拍賣,折扣表如下: * 未滿 2000 無折扣 * 2000~2999 9折 * 3000~3999 8折 * 高於 4000 7折 ``` =JavaScript // input 輸入 sale(5000) sale(2500) sale(3300) sale(200) // output 輸出 3500 2250 2640 200 ``` ### 題目二:水果顏色查詢機 **輸入一個水果名稱,它就回傳對應的顏色 若不是已知的水果,就回覆「查無此水果」** **參考對照表** * 香蕉: "黃色", * 蘋果: "紅色", * 葡萄: "紫色", * 奇異果: "綠色", * 橘子: "橘色", * 藍莓: "藍色", ``` =JavaScript // input 輸入 fruitColor("香蕉") fruitColor("奇異果") fruitColor("小當家") // output 輸出 "黃色" "綠色" "查無此水果" ``` ### 題目三:年薪計算機 以下是梅添良軟體公司的計薪方式 * 每個月固定支薪,不幫員工保勞健保 * 三節沒禮金,也沒任何獎金 * 只有月薪、年終 #### 年終計算 * 未滿一年,不會有年終 * 待超過一年的員工,年終會有 1 個月 * 待超過五年的員工,年終會有 1.3 個月 ``` =JavaScript // input 輸入 // annualSalary(月薪,年資) annualSalary(10000,0.8) annualSalary(12000,1.5) annualSalary(20000,10) // output 輸出 "120000" "156000" "266000" ``` ## 魔王題,請不要輕易接觸,會花上 8hr 時間 ### 梅添良薪水數字大小寫轉換 * 老闆開發票時,很不擅長數字小寫轉大寫,請幫助他這個金魚腦 ``` =JavaScript // input 輸入 changeCapital(35000) changeCapital(9876543210) changeCapital(-33) changeCapital("安安") changeCapital("033") // output 輸出 "參萬伍仟元整" "玖拾捌億柒仟陸佰伍拾肆萬參仟貳佰壹拾元整" "格式錯誤" "格式錯誤" "參拾參元整" ``` :::spoiler 提示 http://tax.0123456789.tw/ ::: ## 回報流程 1. 將答案貼在 Codepen 並複製 Codepen 連結貼至「回報區」回報 (也可以將答案直接貼至「回報區」) ![](https://i.imgur.com/vftL5i0.png) | 報數 | Discord 名字 | Codepen/其他回饋 | |:----:|:------------:|:--------------------------------------------------------------------------------:| | 1 | 4chan | [Codepen](https://codepen.io/ijuolaqc-the-looper/pen/wBBjZwz?editors=1011) | |2|7lun|[Day7-Codepen](https://codepen.io/mfyvqhsn-the-bold/pen/MYYGZQP) 魔王關待補| |3|dean|[Codepen](https://codepen.io/ch933114/pen/wBBjZjr?editors=0011)| |4|小趴|[Codepen](https://codepen.io/papa2415/pen/XWQvzXQ)| |5|B|[Codepen](https://codepen.io/Babel777/pen/YPPLMBG)| | 6 | Joseph_Kyuu | [Codepen](https://codepen.io/zrzfastd-the-reactor/pen/azzGrzO) | |7|pastor|[Codepen](https://codepen.io/peter_hung/pen/QwwrRGz)| | 8 | Archang | [CodePen](https://codepen.io/pxfnrvgk-the-styleful/pen/zxxjQNG)| | 9 | RUDY | [CodePen](https://codepen.io/Rudy-crw/pen/pvvVMgd?editors=0010)待打魔王| | 10 | 叮咚 | [CodePen](https://codepen.io/pinchieh-lin/pen/EaaLqEJ)| | 11 | ying | [CodePen](https://codepen.io/Lara-Lin/pen/gbbzymw)| | 12 | Michael-鴿子 | [CodePen](https://codepen.io/KeinSacer_Michael/pen/emmrqbX)| | 13 | QoQ | [CodePen](https://codepen.io/xxmevbri-the-reactor/pen/raavXXE)魔王待補| | 14 | 馬德 | [CodePen](https://codepen.io/maywang/pen/LEEmwbK?editors=0012)魔王待補| | 15 | 力文 | [CodePen](https://codepen.io/liwenchiou/pen/zxxaGBx?editors=0011)| | 16 |林明德| [CodePen](https://codepen.io/lwescocn-the-vuer/pen/GggGpme?editors=1111) | 17 |周周| [CodePen 魔王待補](https://codepen.io/jhoujhou-the-decoder/pen/bNNKdjz?editors=0012) | 18 | CBK | [CodePen](https://codepen.io/BK-C-the-styleful/pen/oggyxpW) | 19 | Hugh | [CodePen](https://codepen.io/Hugh-Chen/pen/ByyVzra?editors=0011) | 20 | William Hsieh | [CodePen](https://codepen.io/lsaimqxa-the-vuer/pen/myyKrJy?editors=0012)| | 21 | 牛奶 | [CodePen](https://codepen.io/0omilko0/pen/ByyVKqG?editors=0011)| | 22 | Kath | [CodePen](https://codepen.io/JLin-the-lessful/pen/bNNKwBq) 魔王待補| | 23 | SeanLuTW | [CodePen](https://codepen.io/sean85914/pen/raaKLbJ) | | 24 | ArvinSu | [CodePen](https://codepen.io/Arvin-Su/pen/ZYYRBeg) | | 25 | yang |[codepen](https://codepen.io/Yang-J/pen/MYYXJee?editors=0012)| | 26 | ann.328 |[codepen](https://codepen.io/Yang-J/pen/MYYXJee?editors=0012)| | 27 | Anna | [Codepen](https://codepen.io/Anna-Teng/pen/dPPeEzR?editors=1011)| | 28 | mambo | [Codepen](https://codepen.io/chiang_mb/pen/PwwaxmL)| | 29 | WEIWEI | [Codepen](https://codepen.io/weiwei93/pen/ByyVOvZ)魔王待補 | | 30 | mercury2508. | [Codepen](https://codepen.io/Mercury2508/pen/XJJYGPa) | | 31 | nora_zi | [Codepen](https://codepen.io/Nora-Ch/pen/EaaRqRG) 魔王待補 | | 32 | BL | [Codepen](https://codepen.io/bonnieli1414/pen/JooZQKy?editors=0012) | | 33 | Leonard | [Codepen](https://codepen.io/hyyfjqra-the-sans/pen/yyyqJEJ) | | 34 | 蛋白 | [蛋白的JS Codepen Day7](https://codepen.io/sjlu-0/pen/vEEagMb) 魔王待補| | 35 | jingle0900 | [Codepen](https://codepen.io/EvaLi0472/pen/XJJYyBa) | 36 | Apple Pie | [Codepen](https://codepen.io/ymevqzjf-the-builder/pen/gbbKxEm?editors=0011) 魔王待補 | | 37 | stone | [Codepen](https://codepen.io/bgrwlzoz-the-reactor/pen/xbbJqjM)| | 38 | wei_0982 | [Codepen](https://codepen.io/nico-lai/pen/oggyXvx)| | 39 | Chuang| [Codepen](https://codepen.io/uidoytjq-the-solid/pen/GggXBwX?editors=0010) 魔王待補 | | 40 | tung| [Codepen](https://codepen.io/oltsegon-the-looper/pen/oggajKp) 魔王待補 | |41|蛋殼|[Codepen](https://codepen.io/weybrian/pen/PwwyZeY) | 42 | Jessie | [Jessie 的 Codepen](https://codepen.io/bakyfkso-the-looper/pen/zxxmvXo?editors=1010) / 魔王V1(還有bug待修) | 43 | oyll| [Codepen](https://codepen.io/dizzydog-rgb/pen/raaqJgR?editors=0011) | | 44 | Owen He | [Codepen](https://codepen.io/owen1120/pen/ZYYMjYd?editors=0012) | | 45 | Ariel| [Codepen](https://codepen.io/ariel0510/pen/JoomwMp?editors=0011) 魔王待補 | | 46 | Sonia| [Codepen](https://codepen.io/YUJOU/pen/PwwxbEN?editors=0012) | | 47 | 姜承| [Codepen](https://codepen.io/Troy0718/pen/XWxVvbL?editors=0012) | | 48 | Rogan | [Codepen](https://codepen.io/RoganHsu/pen/ByyvboQ?editors=1111) | |49|JHT|[Codepen](https://codepen.io/juanht/pen/XJJOKEO?editors=0012)| | 50 | Toung | [Codepen](https://codepen.io/Toung/pen/GggzezN) 魔王待補 | 51 | vima |[Codepen](https://codepen.io/chin7004/pen/LEEvRdp?editors=0011)| | 52 | ja4071 |[Codepen](https://codepen.io/SHAO-L/pen/NPPmaBV?editors=1112)| | 53 | kelsonhouse |[Codepen](https://codepen.io/Kelson-House/pen/wBBZXBX?editors=0011)| | 54 | allen3290 |[Codepen](https://codepen.io/udadkudw-the-looper/pen/LEEvKKa?editors=1111)| | 55 | duchi |[Codepen](https://codepen.io/sqaz0502/pen/GggaJeX)| | 56 | ninii |[Codepen](https://codepen.io/niiniiii/pen/yyyqZZr)| | 57 | Yi-Kuei |[Codepen](https://codepen.io/Yi-Kuei-Chuang/pen/OPVJMLB?editors=0011)| | 58 | taishan_90178 |[Codepen](https://codepen.io/candy99/pen/raVNJMp?editors=0012)| | 59 | xiaocai_97765 | [Codepen](https://codepen.io/dupre55667788/pen/PwqogEX?editors=0010) | 60 | 610 | [Codepen](https://codepen.io/YI-LING-LIU/pen/yyNOyYp)| | 61 | rinn | [Codepen](https://codepen.io/cqsioetr-the-bold/pen/VYLGrmq)| | 62 | World | [Codepen](https://codepen.io/HexschoolVuePujols/pen/myJGwPg)| | 63 | kent_31665 | [Codepen](https://codepen.io/kentlee406/pen/ByNGNRr?editors=0011)| | 64 | haohaoliao | [Codepen](https://codepen.io/yuyuyuhaohao/pen/gbPaKxX?editors=0012) <!-- 解答: 題目一: function sale(price) { if (price >= 4000) return price * 0.7; if (price >= 3000) return price * 0.8; if (price >= 2000) return price * 0.9; return price; } 題目二: function fruitColor(fruit) { const map = { "香蕉": "黃色", "蘋果": "紅色", "葡萄": "紫色", "奇異果": "綠色", "橘子": "橘色", "藍莓": "藍色", }; return map[fruit] || "查無此水果"; } 題目三: function annualSalary(monthly, years) { let bonus = 0; if (years >= 5) { bonus = monthly * 1.3; } else if (years >= 1) { bonus = monthly; } return (monthly * 12 + bonus).toString(); } 進階題: function changeCapital(num) { if (typeof num === "string") { if (!/^\d+$/.test(num)) return "格式錯誤"; num = Number(num); } if (typeof num !== "number" || num < 0) return "格式錯誤"; const units = ["", "拾", "佰", "仟"]; const sections = ["", "萬", "億", "兆"]; const digits = ["零", "壹", "貳", "參", "肆", "伍", "陸", "柒", "捌", "玖"]; if (num === 0) return "零元整"; let result = ""; let sectionCount = 0; while (num > 0) { let section = num % 10000; if (section !== 0) { let str = ""; let unitPos = 0; let zero = true; while (section > 0) { const digit = section % 10; if (digit === 0) { if (!zero) { zero = true; str = digits[0] + str; } } else { zero = false; str = digits[digit] + units[unitPos] + str; } unitPos++; section = Math.floor(section / 10); } result = str + sections[sectionCount] + result; } else if (!result.startsWith("零")) { result = digits[0] + result; } sectionCount++; num = Math.floor(num / 10000); } return result.replace(/零+/g, "零").replace(/零$/, "") + "元整"; } 回報區 --- | 報數 | Discord 名字 | Codepen/其他回饋 | | |:----:|:------------:|:--------------------------------------------------------------------------------:| :--------------: | | 1 | 4chan | [Codepen](https://codepen.io/ijuolaqc-the-looper/pen/wBBjZwz?editors=1011) | <!--【快速複製】 | num | user | [Codepen]() | -- >

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully