How to split comma separated string using JavaScript? [duplicate]

var partsOfStr = str.split(',');

split()


var array = string.split(',')

and good morning, too, since I have to type 30 chars ...


var result;
result = "1,2,3".split(","); 
console.log(result);

More info on W3Schools describing the String Split function.


Use

YourCommaSeparatedString.split(',');