SHARE
TWEET

Untitled

a guest Feb 14th, 2020 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const countSpaces = (input) => {
  2.   let result = 0;
  3.   input.match(/\s/g) !== null
  4.   ? result = input.match(/\s/g).length
  5.   : result = null;
  6.   if(result) {
  7.     return result;
  8.   } else {
  9.     return "لا توجد أي مسافة";
  10.   };
  11. };
  12.  
  13. console.log(countSpaces("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."));
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