6. Write a JavaScript program to count number of words in string. Go to the editorNote :
-
Remove white-space from start and end position.
- Convert 2 or more spaces to 1.
- Exclude newline with a start spacing.