Counts the number of words in a string. Words are sequences of non-whitespace characters separated by spaces.
The input string to count words from.
The number of words in the string.
1.1.0
wordCount("Hello world!"); // 2wordCount(" This is a test. "); // 4wordCount(""); // 0 Copy
wordCount("Hello world!"); // 2wordCount(" This is a test. "); // 4wordCount(""); // 0
Counts the number of words in a string. Words are sequences of non-whitespace characters separated by spaces.