title: JavaScript remove leading and trailing spaces
body: <p>Here is a test: </p>
  
  <pre><code>console.log(" Golden Katana of the Unflinching Dawn                                    ".replace(/\s+/g,""))
  </code></pre>
  
  <p>I want to remove the extra spaces at the end of the string but it removes every space in the string, so how could I remove just the extra spaces at the end and just keep <code>Golden Katana of the Unflinching Dawn</code>?</p>