Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const countSpaces = (input) => {
- let result = 0;
- input.match(/\s/g) !== null
- ? result = input.match(/\s/g).length
- : result = null;
- if(result) {
- return result;
- } else {
- return "لا توجد أي مسافة";
- };
- };
- console.log(countSpaces("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement