Implement a function to count the number of words in a string.
MediumProblem Statement
Implement a function to count the number of words in a string.
Sample Input
"JavaScript is fun"
Sample Output
3
Limits
Time: 2s · Memory: 256 MB
Implement a function to count the number of words in a string.
"JavaScript is fun"
3
Time: 2s · Memory: 256 MB