title: javascript encodeURIComponent and converting spaces to + symbols
body: <p>I would like to encode my URL, but I want to convert spaces to plus symbols.</p>
  
  <p>This is what I attempted to do...</p>
  
  <pre><code>var search = "Testing this here &amp;";
  
  encodeURIComponent(search.replace(/ /gi,"+"));
  </code></pre>
  
  <p>The output from that is <code>Testing%2Bthis%2Bhere%2B%26</code> but what I would like it to be is <code>Testing+this+here+%26</code> I tried replacing the space with <code>%20</code> to convert it into a plus symbol, but that didn't seem to work. Can anyone tell me what it is I'm doing wrong here?</p>