Truncates a string to a specified number of words.
The string to truncate.
Maximum number of words to keep.
The truncated string.
truncateWords("The quick brown fox", 2); // "The quick"truncateWords("Hello world!", 5); // "Hello world!" Copy
truncateWords("The quick brown fox", 2); // "The quick"truncateWords("Hello world!", 5); // "Hello world!"
1.2.0
Truncates a string to a specified number of words.