SHERIN AS SHERIN AS - 11 months ago 69
jQuery Question

variable values to store a array

how can I variable values to store a array?

Look my code:

var collection =normal,user,student ;
var array = [collection];

In this case, alert would popup a normal,user,student. but i need an array such as array[0] get normal,array[1] get user,array[2] get student like that
how it is possible

Is there any chance to convert such variable into a JS array?

Answer Source
var collection = "normal,user,student";
var jsarray = collection.split(",");