Tell us what’s happening:
Describe your issue in detail here.
Isnt this /^(\s+)|(\s+)$/ equal to this /^\s+|\s+$/g ?
I am asking because the problem doesn’t accept this /^(\s+)|(\s)$/ as the answer
Your code so far
let hello = " Hello, World! ";
let wsRegex = /^(\s+)|(\s+)$/; // Change this line
let result = hello.replace(wsRegex, ""); // Change this line
console.log(result);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36
Challenge: Remove Whitespace from Start and End
Link to the challenge: