title: JavaScript Regex - Remove Whitespace from Start and End
body: <p>I worked on the below challenge for about 3 hours and none of my code was working. Decided to look at the solution to understand why I was not working. When I looked at the solution I was confused because I thought that \s to identify white spaces not to remove them... can someone give me hand and explain why the usage of \s instead of \S and why using the empty string (&quot;&quot;) to get rid of the white spaces on both ends.</p>
  <p><em><strong>CHALLENGE</strong></em></p>
  <p>Write a regex and use the appropriate string methods to remove whitespace at the beginning and end of strings.</p>
  <pre><code>//SOLUTION
  
  let hello = &quot;   Hello, World!  &quot;;
  let wsRegex = /^\s+|\s+$/g; 
  let result = hello.replace(wsRegex, &quot;&quot;);
  </code></pre>