wordCount
Counts the number of words in a string.
wordCount
Signature
typescript
function wordCount(str: string): numberParameters
str- The string to count words in
Returns
Number of words.
Examples
typescript
import { wordCount } from 'strio'
wordCount('hello world')
// 2
wordCount('The quick brown fox')
// 4
wordCount('')
// 0