Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 620 Bytes

words.md

File metadata and controls

33 lines (21 loc) · 620 Bytes

strings.words

words([string], [pattern])

Splits string into an array of its words.

Arguments

  1. [string] (string): string to inspect for words
  2. [pattern] (RegExp|string): regex pattern to match words or string of characters to split words by.

Returns

(Array): Returns an array of words

Example

const result = words('I can, I should, & I will');
console.log(result);
// => ['I', 'can', 'I', 'should', 'I', 'will']