Reputation: 3170
Given a string delimited by commas, how would I go about splitting it into an array in javascript?
Upvotes: 2
Views: 122
Reputation: 113
var array = string.split(",") should do it where string is your string variable
Upvotes: 5
Reputation: 344531
You can simply use the split()
method on your string:
var myString = 'a,b,c';
var myArray = myString.split(',');
Upvotes: 3