title: Iterate over an array in javascript and concat it to another variable
body: <p>I have an array in javascript. I have to iterate over it and concat the values to a variable and each value should be separated by comma.</p>
  
  <p>This is my code:</p>
  
  <pre><code>var selected = new Array();
  jQuery("input[type=checkbox]:checked").each(function() {
      selected.push(jQuery(this).attr('id'));
  });
  </code></pre>