var leg = "15,15,18,40,30,25,60,60,80,70"; var legs = leg.split(","); for(var i=0; i<legs.length; i++) { legs[i] = +legs[i]; }