split a javascript string into an array code example
Example 1: javascript explode
//split into array of strings.
var str = "Well, how, are , we , doing, today";
var res = str.split(",");
Example 2: javascript turn string into array
var fruits = 'apple, orange, pear, banana, raspberry, peach';
var ar = fruits.split(', '); // split string on comma space
console.log( ar );
// [ "apple", "orange", "pear", "banana", "raspberry", "peach" ]