JavaScript Strings Splitting a string into an array

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

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"


Got any JavaScript Question?