Tell us what’s happening:
I passed this challenge, but it does not seem what I did was what I learned from previous challenges. So I am afraid that I did it in a wrong way and I happened to pass it.
Can anybody let me know if there is something wrong with my code and what I should do in stead?
Your code so far
let hello = " Hello, World! ";
let wsRegex = /\S+\s\S+/; // Change this line
let result = hello.match(wsRegex); // Change this line
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end