Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

count no of punctuation in string in js

function countPunctuation(str) {
   const punct = "!,;.-?";
   let count = 0;
   for(let i = 0; i < str.length; i++){
      if(!punct.includes(str[i])){
         continue;
      };
      count++;
   };
   return count;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript check if number is hexadecimal 
Javascript :: lodash remove undefined values from object 
Javascript :: REACt helmet og tags DONT WORK 
Javascript :: redirect with javascript 
Javascript :: javascript e.key 
Javascript :: do while loop 
Javascript :: google sheet app script 
Javascript :: start angular app server 
Javascript :: localstorage 
Javascript :: on hover add class on children jquery 
Javascript :: readfilesync return buffer 
Javascript :: include jsp in another jsp 
Javascript :: yarn add react-native-elements 
Javascript :: var_dump in javascript 
Javascript :: html add class 
Javascript :: javascript enumerate with index 
Javascript :: how to stop react app in terminal 
Javascript :: enzye check if it renders 
Javascript :: remove jquery 
Javascript :: javascript lowercase string except first letter of every word if there are ' 
Javascript :: cryptojs decrypt 
Javascript :: remove event listener jquery 
Javascript :: get authorization header javascript in my page 
Javascript :: navigation.openDrawer is not a function react native 
Javascript :: invert binary tree javascript 
Javascript :: js element text color 
Javascript :: array chaing in js 
Javascript :: errors in Joi 
Javascript :: process.env in nextjs 
Javascript :: javascript to get uri 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =