title: JavaScript .replace only replaces first Match
body: <pre><code>var textTitle = "this is a test"
  var result = textTitle.replace(' ', '%20');
  </code></pre>
  
  <p>But the replace functions stops at the first instance of the " " and I get the </p>
  
  <p>Result : <code>"this%20is a test"</code></p>
  
  <p>Any ideas on where Im going wrong im sure its a simple fix.</p>