I have an string as this:
var a="12,332,22,212";
Now I split it to an array like this:
a=a.split(",");
Then
a=["12","332","22","212"];
While I want to get an array like this:
a=[12,332,22,212];
Which means that the element of the array should be Number
.
Now I have to iterate the array:
for(var i=0,len=a.length;i<len;i++){
a[i]=parseFloat(a[i]);
}
Is there any alternative idea?