助教天團
      • 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
    • Invite by email
      Invitee

      This note has no invitees

    • 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
    • Note Insights
    • 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 Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
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
  • Invite by email
    Invitee

    This note has no invitees

  • 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 - 字串型別詳解 > # 🏅 JS 任務 Day8 - 字串再複習 ### 題目一:字串輸出 ``` =JavaScript // input 輸入 callString("apple") callString("banana") callString("qqq") // output 輸出 "a-p-p-l-e" "b-a-n-a-n-a" "q-q-q" ``` ### 題目二:字串數量 * 若大於等於五個字元,請只顯示前兩個字 ``` =JavaScript // input 輸入 checkFiveWord("hello") checkFiveWord("hi~") checkFiveWord("Jackson") // output 輸出 "he" "hi~" "Ja" ``` ### 題目三:函式強制正整數相乘 ``` =JavaScript // input 輸入 multiply(2,3) multiply(1,3,5) multiply(7,7,7,7,7) multiply(5,3,-2) multiply(4) // output 輸出 6 15 16807 30 4 ``` ### 題目四: 之後老師將會出有關 **for 迴圈,與陣列操作(forEach、map、sort)的題目**,還請同學在此分享免費學習資源,文章與影片皆可 1. [[MDN]:Loops and iteration](https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration) 2. [[學員 wywsmail] for 迴圈筆記](https://hackmd.io/@wywsmail/SJjkvWA2H) 3. [[HexSchool] JavaScript 陣列處理必學](https://www.youtube.com/watch?v=_vFuDQ_6Xt8) 4. [[GrandmaCan -我阿嬤都會] for 迴圈介紹](https://youtu.be/sTkjk84SIP0) 5. [[Bro Code] 陣列 sort](https://youtu.be/3ohTzWhLua8) 6. [[卡斯伯] 老師的陣列教學 (超推!!!)](https://www.casper.tw/javascript/2017/06/29/es6-native-array/#Array-prototype-every) 7. [[w3schools] JavaScript For Loop](https://www.w3schools.com/js/js_loop_for.asp) 8. [[紅色死神] JavaScript 的 forEach,filter, find, map 用法](https://www.youtube.com/watch?v=QHduGj2HuFs) 9. [[偷米騎巴哥] 操作JS陣列的 20 種方式](https://www.youtube.com/watch?v=x-P1VxUgYG4) :::spoiler 圖解 ![image](https://hackmd.io/_uploads/S1rWi3Hz0.png) ::: 10. [[oxxostudio] JavaScript Array 陣列操作方法大全 ( 含 ES6 )](https://www.oxxostudio.tw/articles/201908/js-array.html) 11. [[Zet] Immutable update 物件與陣列的基本功](https://ithelp.ithome.com.tw/articles/10302252) 12. [[Web Dev Simplified]8 Must Know JavaScript Array Methods](https://www.youtube.com/watch?v=R8rmfD9Y5-c) 13. [[MDN] Array.prototype.reduce()](https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce) 14. [[MDN] Array.prototype.forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) 15. [[MDN] Array.prototype.map()](https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array/map) 16. [[MDN] Array.prototype.sort()](https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) 17. [不再迷失在 JavaScript 的陣列處理](https://w3c.hexschool.com/blog/6ccb7d73) 18. [JavaScript 迴圈:for 迴圈、forEach、for...in、for...of 一次搞清楚](https://www.tpisoftware.com/tpu/articleDetails/2985) 19. [JavaScript 陣列處理方法 filter(), find(), forEach(), map(), every(), some(), reduce()](https://www.hexschool.com/2017/09/01/2017-09-01-javascript-for/) --- ## 回報流程 1. 將答案貼在 Codepen 並複製 Codepen 連結貼至「回報區」回報 (也可以將答案直接貼至「回報區」) ![](https://i.imgur.com/vftL5i0.png) <!-- 解答: 題目一: function callString(str) { return str.split('').join('-'); } 題目二: function checkFiveWord(str) { return str.length >= 5 ? str.slice(0, 2) : str; } 題目三: function multiply(...nums) { // 過濾出正整數 const filtered = nums.filter(n => Number.isInteger(n) && n > 0); // 沒有有效數字時,回傳 0 或其他處理方式 if (filtered.length === 0) return 0; // 相乘 return filtered.reduce((acc, val) => acc * val, 1); } --> 回報區 --- | 報數 | Discord 名字 | Codepen/其他回饋 | |:----:|:------------:|:----------------------------------------------------------------------------:| | 1 | dean | [Codepen](https://codepen.io/ch933114/pen/pvvKrow?editors=0011) | | 2 | 7Lun | [Day8-Codepen](https://codepen.io/mfyvqhsn-the-bold/pen/myyKMdb?editors=0012) | | 3 | 4chan | [Codepen](https://codepen.io/ijuolaqc-the-looper/pen/VYYdzYO?editors=1011) | | 4 | SeanLuTW | [CodePen](https://codepen.io/sean85914/pen/WbbyZeJ) | |5|Saika| [Codepen](https://codepen.io/pen/?editors=0011)| |6|B| [Codepen](https://codepen.io/Babel777/pen/YPPvxmG)| | 7 | William Hsieh | [Codepen](https://codepen.io/lsaimqxa-the-vuer/pen/wBBXrXY?editors=0012) | | 8 | Joseph_Kyuu | [Codepen](https://codepen.io/zrzfastd-the-reactor/pen/GggGMLB) | |9|小趴|[Codepen](https://codepen.io/papa2415/pen/QWPeOGx)| | 10 | ying | [Codepen](https://codepen.io/Lara-Lin/pen/xbbzLqM?editors=1111) | | 11 | Pastor | [Codepen](https://codepen.io/peter_hung/pen/JooZOXr)| | 12 | RUDY | [Codepen](https://codepen.io/Rudy-crw/pen/jEEKZQo?editors=0010)| | 13 | Archang | [CodePen](https://codepen.io/pxfnrvgk-the-styleful/pen/LEErOpO)| | 14 | 登登登 | [CodePen](https://codepen.io/Duncanin/pen/ByyVmKE) | 15 | 叮咚 | [CodePen](https://codepen.io/pinchieh-lin/pen/ZYYRowm?editors=1112) | 16 | 力文 | [CodePen](https://codepen.io/liwenchiou/pen/emmKrob?editors=0011) | 17 | WEIWEI | [Codepen](https://codepen.io/weiwei93/pen/zxxaaRG) | | 18 | WAWATA | [Codepen](https://codepen.io/wa-wa-GNOHC-WA-Wa/pen/myyKaJb) | | 19 | Michael - 鴿子 | [Codepen](https://codepen.io/KeinSacer_Michael/pen/dPPKdrV) | | 20 | ann.328 | [Codepen](https://codepen.io/yqmegupa-the-styleful/pen/jEEKdzd) | | 21 | Hugh | [Codepen](https://codepen.io/Hugh-Chen/pen/azzKeWR?editors=0012) | | 22 | 馬德 | [Codepen](https://codepen.io/maywang/pen/oggyPOX?editors=0010) | | 23 | QoQ | [Codepen](https://codepen.io/xxmevbri-the-reactor/pen/KwwBPaG)| | 24 | CBK | [Codepen](https://codepen.io/BK-C-the-styleful/pen/jEEpOeq)| | 25 | BL | [Codepen](https://codepen.io/bonnieli1414/pen/MYYBWRm?editors=0011)| | 26 | ArvinSu | [Codepen](https://codepen.io/Arvin-Su/pen/emmjpEd)| | 27 | yang |[codepen](https://codepen.io/Yang-J/pen/qEEyqZE?editors=0012)| | 28 | jingle0900 |[codepen](https://codepen.io/EvaLi0472/pen/emmjWEa?editors=1010)| | 29 | nora_zi | [Codepen](https://codepen.io/Nora-Ch/pen/dPPqPVa?editors=1111) | | 30 | Leonard | [Codepen](https://codepen.io/hyyfjqra-the-sans/pen/ByyOooP) | | 31 | 牛奶 | [Codepen](https://codepen.io/0omilko0/pen/LEEJZqQ?editors=0011) | | 32 | user | [Codepen](https://codepen.io/Mercury2508/pen/yyyxOww) | | 33 | Apple Pie | [Codepen](https://codepen.io/ymevqzjf-the-builder/pen/MYYqXzZ?editors=0012) | | 34 | Chuang | [Codepen](https://codepen.io/uidoytjq-the-solid/pen/OPPorLG?editors=0011) | | 35 | wei_0982 | [Codepen](https://codepen.io/nico-lai/pen/myyjWwd) | |36|蛋殼|[Codepen](https://codepen.io/weybrian/pen/XJJxdzo) | 37 | Jessie | [Jessie 的 Codepen](https://codepen.io/bakyfkso-the-looper/pen/EaadNrB) |38| tung |[Codepen](https://codepen.io/oltsegon-the-looper/pen/EaadWPm)| |39| Kath |[Codepen](https://codepen.io/JLin-the-lessful/pen/YPPJVgW)| | 40 | Owen He | [Codepen](https://codepen.io/owen1120/pen/QwwZzvw?editors=0012) | | 41 | Ariel | [Codepen](https://codepen.io/ariel0510/pen/WbbaLgQ?editors=0011) | | 42 | Sonia | [Codepen](https://codepen.io/YUJOU/pen/zxxMzGX?editors=0011) | | 43 | 姜承 | [Codepen](https://codepen.io/Troy0718/pen/zYmWdEQ?editors=0012) | |44|JHT|[Codepen](https://codepen.io/juanht/pen/JooxKLg?editors=0012)| | 45 | Toung | [Codepen](https://codepen.io/Toung/pen/GggLqgL) | 46 | kelsonhouse | [Codepen](https://codepen.io/Kelson-House/pen/NPPmBmd?editors=0011)| | 47 | Anna | [Codepen](https://codepen.io/Anna-Teng/pen/OPPEQQE?editors=1012)| | 48 | ja4071 | [Codepen](https://codepen.io/SHAO-L/pen/pvvBYZP?editors=1112)| | 49 | duchi | [Codepen](https://codepen.io/sqaz0502/pen/MYYdKxZ)| | 50 | allen3290 | [Codepen](https://codepen.io/udadkudw-the-looper/pen/MYYdmKR?editors=1111)| | 51 | vima | [Codepen](https://codepen.io/chin7004/pen/Kwwjqyp?editors=0011) | | 52 | ninii | [Codepen](https://codepen.io/niiniiii/pen/GggVRqd?editors=1111) | | 53 | Yi-Kuei | [Codepen](https://codepen.io/Yi-Kuei-Chuang/pen/VYLwXdP?editors=1111) | | 54 | xiaocai_97765 | [Codepen](https://codepen.io/dupre55667788/pen/VYLYmdO?editors=0010) | 55 | 610 | [Codepen](https://codepen.io/YI-LING-LIU/pen/bNdpedX) | | 56 | taishan_90178| [Codepen](https://codepen.io/candy99/pen/emNGYQy?editors=0012) | 57 | kent_31665 | [Codepen](https://codepen.io/kentlee406/pen/pvJQJaB?editors=0011) | | 58 | haohaoliao | [Codepen](https://codepen.io/yuyuyuhaohao/pen/QwyEjXe?editors=0012) | <!--【快速複製】 | 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