Habibullah_Asif

Untitled

Jan 20th, 2021
563
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var strings = "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of  letters, as opposed to using 'Content here, content here', making it look like readable English.";
  2.  
  3. var cnt = 0;
  4. for(var i = 1; i < strings.length; i++){
  5.     if (strings[i] != ' ' && strings[i-1] == ' '){
  6.         cnt++;
  7.     }
  8. }
  9. console.log("Total number of words : " , cnt+1);
RAW Paste Data