split
Converting a string to an array.
Examples
Split by Character
Splitting a CSV string into an array.
let text = "a,b,c,d,e";
const myArray = text.split(",");
console.log(myArray[0]); // "a"Split by Space
Splitting sentences into words.
let text = "Hello World";
const arr = text.split(" ");
console.log(arr); // ["Hello", "World"]Test Your Knowledge
JavaScript Quiz
No quiz available for this topic yet.