Split a sting array into a number array in javascript

Posted by Wesley Skeen on Stack Overflow See other posts from Stack Overflow or by Wesley Skeen
Published on 2012-10-09T09:33:17Z Indexed on 2012/10/09 9:37 UTC
Read the original article Hit count: 159

Filed under:
|

I am reading a value from a dropdown list depending on what option is selected. I am using jqPlot to graph the values.

jqPlot expects an array of values like [91, 6, 2, 57, 29, 40, 95]

but when I read the value in from the dropdown box it is coming in as a whole string "[91, 6, 2, 57, 29, 40, 95]"

I tried splitting it but I got ["91", "6", "2", "57", "29", "40", "95"] which wont display the graph correctly.

Is there anybody that has encountered something like this before and what can I do to make my values convert into a number array.

Thanks for any help

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jqplot