title: JavaScript split() using a common character then join() using different characters
body: <p>Assuming I have a string: <strong><code>/someFolder/anotherFolder/fileName</code></strong> and I want to replace all the forward slashes with a <code>"+"</code> then this would work:</p>
  
  <pre><code>var someString = '/someFolder/anotherFolder/fileName'
  someString.split('/').join('+');
  </code></pre>
  
  <p>Or using regex, this would work:</p>
  
  <pre><code>var someString = '/someFolder/anotherFolder/fileName'
  someString.replace(/\//g, "+");
  </code></pre>
  
  <hr>
  
  <p>But what would be the best approach if I want to replace the first occurence with a '+' then the second occurence with another character like say, the '-', the third with '*' and so on so that the string <code>someString</code> above returns:</p>
  
  <pre><code>+someFolder-anotherFolder*fileName
  </code></pre>