I have a string named :
graph_data =[16.665,0,16.665,19.23,35.79,16.665,31.71,16.665,0,16.665,0,16.665,16.665,41.615]
I wanted to covert it to array of number. I am using the following code:
var graph_data1=new Array();
var graph_data = graph_data.split(",");
for (var i=0; i<graph_data.length; i++)
{
graph_data1[i] = parseFloat(graph_data[i]);
}
the output of graph_data1 is showing following NaN,0,16.665,19.23,35.79,16.665,31.71,16.665,0,16.665,0,16.665,16.665,41.615
can any one tell me why it is adding Nan and 0
thanks in advance .
[16.665which is NaN ... your second element is0, which is why you get a0graph_data=?