title: Replace all spaces in a string with '+'
body: <p>I have a string that contains multiple spaces. I want to replace these with a plus symbol. I thought I could use </p>
  
  <pre><code>var str = 'a b c';
  var replaced = str.replace(' ', '+');
  </code></pre>
  
  <p>but it only replaces the first occurrence. How can I get it replace all occurrences?</p>