How to count vowels in a string with Node.js

1 Answer

0 votes
function vowel_count(str) {
  	const vowels = /[aeiou]/gi;
  	const result = str.match(vowels);
  	const count = result.length;
     
  	return count;
}
  
console.log(vowel_count("nodejs programming"));
    
    
      
      
/*
run:
  
5
      
*/

 



answered May 12, 2022 by avibootz

Related questions

1 answer 135 views
1 answer 114 views
1 answer 126 views
2 answers 164 views
1 answer 139 views
1 answer 135 views
...