Advertisement
samfrancisco

Software Engineering Coding Challenge 3 (Javascript)

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