title: Javascript: How to replace certain characters from a string?
body: <p>I was trying to get a set of names from URL as URL parameter.</p>
  
  <pre><code>var url_arrays = [],url_param;
  var url = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&amp;');
  for (var i = 0; i &lt; url.length; i++)
          {
              url_param = url[i].split('=');
              url_arrays.push(url_param[0]);
              url_arrays[url_param[0]] = url_param[1];
          }
  var temp = decodeURIComponent(url_arrays[2]).split(','||' ');
  </code></pre>
  
  <p>but this way I am getting output like this</p>
  
  <p><code>[jon</code> <code>Ned</code> <code>Brian</code> <code>Sam]</code></p>
  
  <p>How to remove the opening &amp; closing bracket ?</p>
  
  <p><code>replace</code> method is there in javascript but in that I can't replace a set of characters like <code>str.replace('['||']','')</code></p>