title: Remove comma from javascript array
body: <p>Hi all I am framing a url with Query string in javascript as follows every thing works fine but a comm is coming in between the query string so can some one help me</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function RedirectLocation() {
          var cntrl = "Q1;Q2";
          var str_array = cntrl.split(';');
          var cnt = str_array.length;
          if (cnt == 0) {
              location.href = '/callBack.aspx';
          }
          else {
              var arr = [];
              for (var i = 0; i &lt; str_array.length; i++) {
                  str_array[i] = str_array[i].replace(/^\s*/, "").replace(/\s*$/, "");
                  arr.push(str_array[i] + '=1');
                  if (i != str_array.length - 1) {
                      arr.push('&amp;');
                  }
              }
              location.href = '/Sample.aspx?' + arr;
          }
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>This is giving me the query string as follows <code>Sample.aspx?Q1=1,&amp;,Q2=1</code> I need this to be like <code>`Sample.aspx?Q1=1&amp;Q2=1</code></p>