Tell us what’s happening:
Describe your issue in detail here.
Dear all,
I have question regarding /^\s+|\s+$/g, since the plus sign after ^\s and before $ already means the whitespace can be more than 1, why is it necessary to add g at the end.
Thanks for helping!
Your code so far
let hello = " Hello, World! ";
let wsRegex = /^\s+|\s+$/g //; // Change this line
let result = hello.replace(wsRegex, "")
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15
Challenge: Remove Whitespace from Start and End
Link to the challenge: