split()
noun
say it: “SPLIT” /splɪt/
A JavaScript string method that cuts text into an array of pieces wherever a separator appears, such as 'Ana,Ben,Cy'.split(',').
What does split() do in JavaScript?
split() — Breaks a string into a list of pieces.
const words = "tea coffee".split(" ");
const label = words.join(" & ");
In a sentence
- “I used split(',') to turn the line of runner names into a list I could loop over.”
Level: Apprentice · More JavaScript terms at this level
Updated