JavaScript String split() Method
console.log('a+very+nice+string'.split('+'));
Result: ["a", "very", "nice", "string"] Separate each character, including white-space:
const res = "How are you doing today?".split("");
console.log(res); 
Result: ["H", "o", "w", " ", "a", "r", "e", " ", "y", "o", "u", " ", "d", "o", "i", "n", "g", " ", "t", "o", "d", "a", "y", "?"] Use the limit parameter:
const resLimit = "How are you doing today?".split("", 3);
console.log(resLimit);
Result:["H", "o", "w"] Use a letter as a separator:
const resO = "How are you doing today?".split("o" );
console.log(resO);
Result:["H", "w are y", "u d", "ing t", "day?"]
by გიორგი ბაკაშვილი
4 years ago
0
Pro tip: use ```triple backticks around text``` to write in code fences