I have a string, called coordlist. It is empty (coordlist=""). If the string is empty at the time, I would like for it to make coordlist = b(an arguement). If there is already a number there, then make the string coordlist+"-"+b. I can run this the first time, but the second time, I get an error message.
function addCoord(b)
{
if(coordlist.split("-").length==1){coordlist=b;}
else if(coordlist.split("-").length==2){coordlist=coordlist+"-"+b;}
else if(coordlist.split("-").length==3){coordlist=b}
alert(coordlist);
}