Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Requirements:
- * Write a function that accepts a string and returns the number of words in the given string.
- * Also make your function resilient (i.e., handling different inputs).
- *
- * Write your solution without using any libraries and use ES6 or above as much as possible.
- */
- function countWords(sentence) {}
- let sentence = 'A quick brown fox jumps over the lazy dog';
- countWords(sentence); // Output: 9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement