SHARE
TWEET

Untitled

a guest Aug 14th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "abc def rr tt" // should return 3
  2. "34 45n v" // should return 2
  3.      
  4. ("abc def rr tt".split(" ").length - 1)
  5.      
  6. var length = "abc def rr tt".split(" ").length - 1;
  7.      
  8. String.prototype.getWhitespaceCount = function() {
  9.     return this.split(" ").length - 1
  10. }
  11.  
  12. var x = "abc def rr tt";
  13. var length = x.getWhitespaceCount();
  14.      
  15. str.split(' ').length-1
  16.      
  17. "abc def rr tt".match(/s/g).length;
  18.      
  19. str.length - str.replace(/s+/g, '').length;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top