Why i cant pass the challenge ? regular expressions

Tell us what’s happening:
Describe your issue in detail here.
why i cant pass the challenge with this solution?

Your code so far

let hello = "   Hello, World!  ";
let wsRegex = /(\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 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36

Challenge: Remove Whitespace from Start and End

Link to the challenge:

Read about how to specify start and end of the string and also about flags that you may use with the regexp.

Your current solution will erase only one \s+ sequence wherever it is.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.