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

I want to split a comma separated string with JavaScript. How?

Answers:

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

split()

Answer
var array = string.split(',')

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

Answer

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

More info on W3Schools describing the String Split function.

Answer

Use

YourCommaSeparatedString.split(',');

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.