Why doesnât split(â â) work, while split(/\s+/) does?
Hello, I was solving a JavaScript coding problem on freeCodeCamp and submitted my solution (code attached in this post). Unluckily my solution hasnât been accepted even though the output in the console is the expected one. The solution of FCC is the same as my code, but instead of split(â â), they used split(/\s+/), using a regex in parenthesis. My question is: in this case technically split(â â) should be correct, right? If not, could you kindly explain to me why? Thanks in advance. P.S. Original problem can be found at the following link: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs https://code.sololearn.com/c2E9SfEicL1U/?ref=app https://code.sololearn.com/c2E9SfEicL1U/?ref=app https://code.sololearn.com/c2E9SfEicL1U/?ref=app