Counts the number of words in a string. Words are defined as sequences of letters, numbers, and apostrophes separated by whitespace.
String input to count words from
Number of words in the string
countWords('Hello, world!'); // 2 Copy
countWords('Hello, world!'); // 2
Counts the number of words in a string. Words are defined as sequences of letters, numbers, and apostrophes separated by whitespace.