--- tags: 公益程式體驗營 - 2022 --- # 🏅 5/5(四) 每日 JS 刷題任務 - 字串設計 ## 提示 1. [JavaScript 字符串方法](https://www.w3school.com.cn/js/js_string_methods.asp) ### 題目一:字串長度計算 ``` =JavaScrip // input 輸入 checkStringLength("Hello") checkStringLength("my name is Tom!") // output 輸出 5 15 ``` ### 題目二:英文強制小寫 ``` =JavaScript // input 輸入 lowerCase("FOKFF@gmail.com") lowerCase("gonSakpm@gmail.com") // output 輸出 "fokff@gmail.com" "gonsakpm@gmail.com" ``` ### 題目三:去除掉段落的左右空白 ``` =JavaScript // input 輸入 trimString(" hi, mom! ") trimString(" aa@gmail.com ") // output 輸出 "hi, mom!" "aa@gmail.com" ``` ### 題目四:字串依照條件轉陣列 ``` =JavaScript // input 輸入 splitString("black,red,white") splitString("coffee,tea") // output 輸出 // ["black","red","white"] // ["coffee","tea"] ``` ### 題目五:切割市區字串 ``` =JavaScript // input 輸入 getArea("高雄市前鎮區一心二路33號"); getArea("高雄市新興區新興路66號"); // output 輸出 "前鎮區" "新興區" ``` ## 回報流程 1. 將答案貼在 Codepen 並複製 Codepen 連結貼至「回報區」回報 (也可以將答案直接貼至「回報區」) ![](https://i.imgur.com/vftL5i0.png) <!-- 解答: --> 回報區 --- <!-- 0. Bingbingboom(回報範例,請使用註解回報) 答案:(可直接撰寫答案) Codepen:https://codepen.io/Bingbingboom/pen/jOBZVWq --> <!-- 1. 洧杰 答案:(可直接撰寫答案) Codepen:https://codepen.io/hexschool/pen/wvyvQqZ?editors=0011 --> <!-- 2. Bruno Yu 答案:(可直接撰寫答案) Codepen:https://codepen.io/bruno-yu/pen/dydogey?editors=1111 --> <!-- 3. Aaron 答案:(可直接撰寫答案) Codepen:https://codepen.io/narrowd4c/pen/GRQJoJP?editors=1111 --> <!-- 4. Lemon 答案:(可直接撰寫答案) Codepen:https://codepen.io/shumhoyin/pen/YzeXJdw --> <!-- 5. Tuhacrt#0008 Codepen: https://codepen.io/Tuhacrt/pen/GRQJYXj?editors=0012 --> <!-- 5. Josh Chen#4552 Codepen: https://codepen.io/hiphop825/pen/LYQVgaE?editors=0010 --> <!-- 7. CloThEs 答案: Codepen:https://codepen.io/bogwdnxx-the-sans/pen/xxYGyMv --> <!-- 8. yunyun 答案: Codepen:https://codepen.io/yun_yunni/pen/oNEXaJg --> <!-- 9. Noy https://codepen.io/MochiCodingPen/pen/PoQqyVm --> <!-- 10. Rex Chu 答案: Codepen:https://codepen.io/rex_chu/pen/oNEXayN --> <!-- 11. su#7798 Codepen . https://codepen.io/wc-su/pen/ExQjdrz --> <!-- 12. hw#0715 Codepen: https://codepen.io/Lhwei/pen/bGLdmZY --> <!-- 13. Art Codepen: https://codepen.io/ss97202tw/pen/WNMvYbJ --> <!-- 14. Wendy 答案:(可直接撰寫答案) Codepen:https://codepen.io/wendy03/pen/RwQPqaV --> <!-- 15. Eric.S Codepen: https://codepen.io/Eric_Shen/pen/GRQJwvO --> <!-- 16. shijia 答案:(可直接撰寫答案) Codepen:https://codepen.io/shijia22/pen/BaYNGoJ?editors=0011 --> <!-- 17. Murmurline#6969 答案: // length // toLowerCase() // trim() // split() // substr(x, x) Codepen:https://codepen.io/murmurline/pen/vYdOQym --> <!-- 18. pipi 答案:(可直接撰寫答案) Codepen:https://codepen.io/pipiyy13/pen/jOZPQRj --> <!-- 19. Patti Chiu Patti#7774 Codepen:https://codepen.io/peiru-qiu/pen/YzeXRPG?editors=0011 --> <!-- 20. shujhen#7734 Codepen:https://codepen.io/shujhen/pen/ExQjOrg --> <!-- 21. Jason Chen Codepen:https://codepen.io/jason60810/pen/poaJqyJ --> <!-- 22. JustinLiu Codepen: https://codepen.io/justin0227/pen/xxYGmRX?editors=0010 --> <!-- 23. Stella/UIUX/台北#7394 Codepen: https://codepen.io/ting-juan-huang/pen/oNEXJxE --> <!-- 24. IreneLee CodePen: https://codepen.io/ntjtcxpt-the-animator/pen/zYRGybR?editors=0012 --> <!-- 25. Peng https://codepen.io/peng-027/pen/ZErGVZJ --> <!-- 26. Vera#5592 https://codepen.io/skvera/pen/zYRGyyp?editors=0011 --> <!-- 27. yuyu#6310 https://codepen.io/yuyu0905/pen/XWZboQV --> <!-- 28. SASIMI#5099 Codepen: https://codepen.io/sashimi1327/pen/LYQVqJP --> <!-- 28. andersonshen#4675 Codepen: https://codepen.io/luxyenni-the-bold/pen/oNEXVYL --> <!-- 29.Lian Chen Codepen:https://codepen.io/CCL1007/pen/ZErGPME --> <!-- 30. rejennylo Codepen: https://codepen.io/reJennylo/pen/xxYGeKq --> <!-- 31. Leo Song Codepen: https://codepen.io/sunnylaba/pen/vYdOPoR?editors=0010 --> <!-- 32. 翁來 Codepen: https://codepen.io/wguo8320/pen/BaYNEOa --> <!-- 33. zzuhann #2786 codepen: https://codepen.io/zzuhann/pen/GRQJLzb --> <!-- 34. beanHuang codepen: https://codepen.io/Beanhuang/pen/eYVNaGK?editors=0011 --> <!-- 35. Joyce#3790 codepen: https://codepen.io/joycehuang/pen/eYVNarL?editors=0011 --> <!-- 36. Chi Codepen: https://codepen.io/YoChi84/pen/ExQjzpM --> <!-- 37. 小鹿Kerwin#5730 Codepen: https://codepen.io/tkoleo84119/pen/YzeXgLx?editors=0012 --> <!-- 38. 楓之聲#6945 Codepen: https://codepen.io/sshane258/pen/ExQjzdM --> <!-- 39. Van.CS #2067 Codepen: https://codepen.io/fbacojji-the-selector/pen/poaJYKm?editors=0012 --> <!-- 40.deveryone#8090 Codepen: https://codepen.io/raycheng/pen/jOZPjKJ?editors=0110 --> <!-- 41. lyle#8123 Codepen: https://codepen.io/tomys/pen/KKQpOap --> <!-- 42. Mojito#6004 codepen: https://codepen.io/vu3xk41997/pen/qBxOWOQ --> <!-- 43. Roceil #5501 codepen: https://codepen.io/Roceil/pen/bGLVGdL?editors=1111 --> <!-- 43. 鉦勝 #8333 codepen: https://codepen.io/atckmax823/pen/xxYwKgQ?editors=0011 --> <!-- 44. KuoMin#4931 codepen: https://codepen.io/KuoMin/pen/MWQwdRP --> <!-- 45. Lao#4012 codepen: https://codepen.io/rao418065/pen/xxYwKQN?editors=0011 --> <!-- 46. Triple https://codepen.io/riku30/pen/bGLVbaq --> <!-- 47. Knn#0492 codepen: https://codepen.io/Knn_84/pen/wvyKBvN --> <!-- 48. Greta#0837 codepen: https://codepen.io/gretali/pen/gOvabYd --> <!-- 49.Lina Chen codepen: https://codepen.io/LinaChen/pen/jOZbOQR --> <!-- 50.Arista codepen: https://codepen.io/arista-hsieh/pen/wvyKBGZ --> <!-- 51. Martin codepen: https://codepen.io/chihsuanbjjh/pen/bGLVNWX?editors=0011 --> <!-- 52. Jim#8764 codepen: https://codepen.io/jim255060/pen/BaYoNzK --> <!-- 53. 隔壁小王 codepen: https://codepen.io/stevetanus/pen/dydYPLQ --> <!-- 54. Alphacostankion#8475 https://codepen.io/alphapolo/pen/OJQyLLV --> <!-- 55.Xiang#5313 https://codepen.io/snorlaxxu/pen/abqvOWQ?editors=0011 --> <!-- 56. Ryan Lu https://codepen.io/ryanlu1125/pen/JjpYdQP?editors=0012 --> <!-- 58. Jia-Hong Chen#3863 https://codepen.io/iloveleon19/pen/yLvYNbP?editors=0010 --> <!-- 59. Chaco Chen#2993 https://codepen.io/chaco-wang/pen/LYQppYV?editors=0012 --> <!-- 60. bonnieli1414#4906 https://codepen.io/bonnieli1414/pen/yLvYYWB --> <!-- 61. 白狐 Codepen:https://codepen.io/baihu7851/pen/MWQaKYw --> <!-- 62. bakiii#2652 https://codepen.io/aki168/pen/ZErbQaB --> <!-- 63. Lam#0344 https://codepen.io/manshun-lam/pen/xxYwZMW --> <!-- 64 DoubleZ#2361 https://codepen.io/lazywyatt/pen/OJQyVyy? --> <!-- 65 Stanley#3825 https://codepen.io/sean_1215/pen/mdXePpe?editors=0011 --> <!-- 66. AllenLi#6756 https://codepen.io/knsybndf-the-animator/pen/VwQvLJe?editors=0011 --> <!-- 67. ChaoChao https://codepen.io/EmiiilyJ/pen/vYdNKqp --> <!-- 68. 小不點#1793 https://codepen.io/fwmfmgkx-the-flexboxer/pen/NWyGrQJ?editors=1111 --> <!-- 69. _伊凡Evan https://codepen.io/Evan_9837/pen/MWQabyE --> <!-- 70.米金#1399 https://codepen.io/ihrowjtq-the-vuer/pen/poaJmZL --> <!-- 71.Morris https://codepen.io/morrisss/pen/rNJOzKy?editors=0001 --> <!-- 72.hsiuhsiu#7412 https://codepen.io/hsiuhsiu/pen/poajrKy?editors=0012 --> <!-- 73.Katie https://codepen.io/Katie24/pen/RwQWjro?editors=0011 --> <!-- 74. danny123 codepen: https://codepen.io/binlandz123/pen/VwQvrWK?editors=0010 --> <!-- 75. 教練#6451 codepen: https://codepen.io/monkeybear721/pen/yLvYzKp --> <!-- 76. Charlotte Lee codepen: https://codepen.io/charlotte-lee/pen/YzeyYBR?editors=0012 --> <!-- 77. Yuhung#1391 codepen: https://codepen.io/Yu__hung/pen/NWyGYPw?editors=0012 --> <!-- 78. 炎炎#0777 codepen: https://codepen.io/kimyen260/pen/OJQyZVB?editors=0011 --> <!-- 79. Vivi#5766 codepen: https://codepen.io/hyxfish27/pen/LYQpdMb --> <!-- 80. 肉桂卷#0625 codepen: https://codepen.io/ginnlee/pen/VwQvEQJ?editors=0011 --> <!-- 81. Abel codepen: https://codepen.io/lun_chi/pen/abqvRYQ?editors=0010 --> <!-- 82. Mylène codepen: https://codepen.io/hamajibashi/pen/KKQdrPo --> <!-- 82. sheep#4352 codepen: https://codepen.io/chingyeeee/pen/LYQGERL --> <!-- 83.Tsuei#9284 https://codepen.io/AlbertoLL/pen/zYRrrdK?editors=0011 --> <!-- 84. Sussu#4211 https://codepen.io/yatiti84/pen/MWQKJyB?editors=1111 --> <!-- 85. carrieT#9628 https://codepen.io/echocarriet/pen/QWQydqr --> <!-- 86. 靜宜#6866 (可直接撰寫答案) https://codepen.io/jamie18/pen/eYVJgLa --> <!-- 87. JumpBow#8940 https://codepen.io/jump-bow/pen/rNJxypL?editors=0011 --> <!-- 88. will0708#7730 https://codepen.io/ncrdpepc-the-lessful/pen/dydGRXP?editors=0010 --> <!-- 89. Bao#4997 https://codepen.io/baoh/pen/MWQwdxq?editors=0011 --> <!-- 90. karakamin#3416 Codepen: https://codepen.io/karakamin/pen/vYdLjOJ?editors=0011 --> <!-- 91. RayChen#6088 Codepen: https://codepen.io/raychen1996/pen/bGLEKwN --> <!-- 92. Cheng#3012 codepen: https://codepen.io/XiBinCheng/pen/LYQGXEo?editors=1111 --> <!-- 92. Cheng-Yu#1813 codepen: https://codepen.io/ball77111/pen/wvyMLbm?editors=0011 --> <!-- 93. TaoDoris#5230 codepen: https://codepen.io/peetaoting/pen/WNMwbLq?editors=1111 --> <!-- 94. WilliamChou#7375 codepen: https://codepen.io/williampo78/pen/RwQaWmp --> <!-- 95. mei#8421 codepen: https://codepen.io/Shila-Chen/pen/jOZqMpj --> <!-- 96. 安安你好你是誰#7416 codepen: https://codepen.io/leave3310-the-looper/pen/BaYKQNe --> <!-- 97. Amberhh#2465 codepen: https://codepen.io/Amberhh/pen/bGLpNEj?editors=0010 --> > <!-- 97. han#9437 codepen: https://codepen.io/qnrxylcw-the-reactor/pen/yLvOEVO --> <!-- 97. BeckyYo#1461 codepen: https://codepen.io/bearbecky/pen/oNExKNj?editors=1111 --> <!-- 100. 101010#8077 codepen: https://codepen.io/im1010ioio/pen/XWZKJNv?editors=0112 --> <!-- 101. Pearlie#3536 codepen: https://codepen.io/PPcode/pen/LYQZVbe --> <!-- 102. Jill#5577 Repl.it: https://replit.com/@Jillkate/Hex-daliy-22-05-05#index.js --> <!-- 103. codepen:EllieLo#9809 https://codepen.io/ellie-lo/pen/YzeWVYj?editors=0011 --> <!-- 104. Wilson#8687 codepen: https://codepen.io/foolwilson/pen/MWQePRJ --> <!-- 105. Choo.ku codepen: https://codepen.io/chooku/pen/GRQqedJ?editors=0012 --> <!-- 106. cyndi#8308 codepen: https://codepen.io/swi963/pen/MWQyXWa?editors=0010 --> <!-- 107. Kiwi#9804 codepen:https://codepen.io/kiwi1113/pen/ZErpZXq --> <!-- 108. littlesun#9469 codepen:https://codepen.io/littlesun10111/pen/gOvLWjj --> <!-- 109. YANSzero#5436 codepen: https://codepen.io/yanszero/pen/rNJWRoG?editors=0010 --> <!-- 110. 一隻阿貓#2726 codepen:https://codepen.io/chenchaoyen/pen/poaNmJx --> <!-- 111. Chaoci#2460 codepen: https://codepen.io/gmailchao/pen/GRQrNqm?editors=0010 --> <!-- 112. Susan8402#5854 codepen: https://codepen.io/Susan8402/pen/xxYgqzB?editors=0012 --> <!-- 113. Vito#7797 https://codepen.io/Vito_Yang/pen/wvyJabx?editors=0012 --> <!-- 114. 黑白兔#0684 codepen: https://codepen.io/johnny329/pen/poaPveE --> <!-- 115. Mitour#0672 codepen https://codepen.io/mitour/pen/xxYrWoE --> <!-- 116. zera#6060 codepen : https://codepen.io/zera-tseng/pen/OJQjMKK?editors=1111 --> <!-- 117. 家洋#6999 https://codepen.io/yang940648/pen/xxYPRNj --> <!-- 118. JessieCho https://codepen.io/jessieCho/pen/JjpMEjL --> <!-- 119. yolala https://codepen.io/chiakilalala/pen/rNJpqQM --> <!-- 120. 艾芮絲#6060 codepen https://codepen.io/wangyingju/pen/bGLLVWN?editors=0010 --> <!-- 121. How#5806 codepen https://codepen.io/howtobefine/pen/mdXXNgO?editors=0010 --> <!-- 122. 小金#3256 codepen: https://codepen.io/AmoGH357/pen/XWZBBpL --> <!-- 123. 眠瀾#8857 CodePen: https://codepen.io/laron9486/pen/YzeoMdJ --> <!-- 124. xuan#0808 codepen:https://codepen.io/xuan0915/pen/yLKXeWR?editors=0011--> <!-- 125. WangShuan(雅萱)#0947 const checkStringLength = function (str) { return str.length; } const lowerCase = function (str) { return str.toLowerCase() } const trimString = function (str) { return str.trim() } const splitString = function (str) { return str.split(',') } const getArea = function (str) { return str.substr(3, 3) } --> <!-- 126. Ayre#0016 codepen:https://codepen.io/yichunlin09/pen/bGvrgJG?editors=0011--> <!-- 127. Leone#0851 codepen:https://codepen.io/Leoneboy/pen/wvmqgRV?editors=0011 --> <!-- 128. Ada codepen: https://codepen.io/zggsoagv-the-scripter/pen/MWVvpmE --> <!-- 129. Yanyan#3555 codepen: https://codepen.io/wei-yi-lee/pen/zYWdzdo --> <!-- 130. Nyanwu#7129 codepen: https://codepen.io/a07401234/pen/wvmqrRX --> <!-- 131. Claire#2116 codepen:https://codepen.io/claire-chang-the-bashful/pen/QWmMQya --> <!-- 131. SHIN#6075 codepen:https://codepen.io/shin9626/pen/PoRKXxZ --> <!-- 131. SunnyCheng#4113 codepen:https://codepen.io/Sunny0509/pen/OJvxxax?editors=0011 --> <!-- 134: huch09#1426 codepen: https://codepen.io/subarashii-huch09/pen/mdxqZQq?editors=1112 --> <!-- 135: DaleHsu#0355 codepen: https://codepen.io/dale_hsu/pen/VwXypjr --> <!-- 136: john21429 codepen: https://codepen.io/john21429/pen/bGvvLwy --> <!-- 137: JOU#6876 codepen: https://codepen.io/joujoujou924/pen/ExEpOeb --> <!-- 138: Harmonia#3139 codepen: https://codepen.io/corly74/pen/oNqJEBJ?editors=1011 --> <!-- 139: Sophia19#4005 codepen: https://codepen.io/sophia019/pen/xxjbyrJ <!-- 140: