split()
Splits the text into an array.
Syntax
text.split(separator)
Description
Splits the text by the given separator and returns the pieces as an array.
Returns
Array of pieces.
Example
Loading editor…
Expected output
[ 'a', 'b', 'c' ]
When to use?
Splitting a CSV line into fields, a sentence into words.