Splitting a string into an array

suggest change

Use .split to go from strings to an array of the split substrings:

var s = "one, two, three, four, five"
s.split(", ");  // ["one", "two", "three", "four", "five"]

Use the array method .join to go back to a string:

s.split(", ").join("--");  // "one--two--three--four--five"

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents