How can I convert a string to a JavaScript array?
Look at the code:
var string = \"0,1\"; var array = [string]; alert(array[0]);
In
If the string is already in list format, you can use the JSON.parse:
var a = "['a', 'b', 'c']"; a = a.replace(/'/g, '"'); a = JSON.parse(a);