title: Replacing certain characters in javascript
body: <p>Coming from a PHP background, I am a little spoiled with the <code>str_replace</code> function which you can pass an array of haystacks &amp; needles.</p>
  
  <p>I have yet not seen such a function in Javascript, but I have managed to get the job done, altough ugly, with the below shown code:</p>
  
  <p><code>return myString.replace(" ", "-").replace("&amp;", ",");</code></p>
  
  <p>However, as my need to replace certain characters with another character grows, I am sure that there's much better ways of accomplishing this - both performance-wise and prettier.</p>
  
  <p>So what can I do instead?</p>