Tell us what’s happening:
Why doesnt it work?
I believed that my solution was following like this:
- caret stands for start
- (one or more white spaces)
- repeat capture group
4)at the end
Your code so far
let hello = " Hello, World! ";
let wsRegex = /^(\s+)\1$/; // Change this line
let result = hello.replace(wsRegex, "0"); // Change this line
console.log(result)
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 OPR/62.0.3331.119
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end