Javascript loop giving me problems
<p>I want to extract only groups from this string</p>

<p>I want to have something like  in alert "group1,group2"
 but it returns empty.</p>

<pre><code>var phone_nos = "group1,group2,564774890900";   
var recipients = phone_nos.split(",");  
for( var i=0; i&lt;recipients.length; i++ )
 group =recipients[i].substring(0,5)
{ if (group=="group")
         {groups.push(recipients)}


    }
    alert(groups.join(","))
</code></pre>
