title: JavaScript Join inserts comma delimiter when only one item in array
body: <p>I'm filtering XHTML classes; when there is only a single class it inserts a comma at the beginning. This makes classes that are hidden to have a value ",hidden" which ends up displaying hidden content. What am I missing? No frameworks please, I never use them.</p>
  
  <pre><code>var d = new Array();
  
  for (var i=0;i&lt;c.length;i++)
  {
   if (c[i]==c1) {d.push(c2);}
   else if (c[i]==c2) {d.push(c1);}
   else if (c[i]!='') {d.push(c[i]);}
  }
  
  d.join(' ');
  alert(d);
  </code></pre>