Remove Whitespace from Start and End HELP PLZ

Tell us what’s happening:
Can someone explain the solution code for the wsRegex specifically and how the \s is working with the |.

Your code so far

let hello = "   Hello, World!  ";
let wsRegex = /^\s+|\s+$/g; // Change this line
let result = hello.replace(wsRegex,''); // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36.

Link to the challenge:

1 Like
 /  ....^\s+ ....| ....\s+$  ..../ ....g

 ^ = beginning
 \s = space
 + = one or more instances
 $ = end

so, any spaces at the beginning… |… (or)…any spaces at the end