Splits string into an array of its words.
string
The string to inspect.
The pattern to match words.
Returns the words of string.
5.12.0
words('fred, barney, & pebbles')// => ['fred', 'barney', 'pebbles']words('fred, barney, & pebbles', /[^, ]+/g)// => ['fred', 'barney', '&', 'pebbles'] Copy
words('fred, barney, & pebbles')// => ['fred', 'barney', 'pebbles']words('fred, barney, & pebbles', /[^, ]+/g)// => ['fred', 'barney', '&', 'pebbles']
Splits
string
into an array of its words.