Hey,
I'm trying to do a loop in javascript, that adds an array into a variable.
Because it is a bit hard to explain exactly what I want, please look at this code, which does the (for the beginning) same.
var s="one, two, three"; //this can be changed
var p=s.split(',');
var l=p.length;
if(l==1){fn(p[0]);}
if(l==2){fn(p[0],p[1]);}
if(l==3){fn(p[0],p[1],p[2]);}
if(l==4){fn(p[0],p[1],p[2],p[3]);}
if(l==5){fn(p[0],p[1],p[2],p[3],p[4]);}
......
All the if-statements should be replaced by a nice loop.
Anybody has an idea?