Counts the number of whitespace-separated words in a string.
The input string.
countWords("hello world") // => 2countWords("") // => 0countWords(" ") // => 0 Copy
countWords("hello world") // => 2countWords("") // => 0countWords(" ") // => 0
Counts the number of whitespace-separated words in a string.