How to count vowels in a string with TypeScript

1 Answer

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

 



answered May 12, 2022 by avibootz

Related questions

1 answer 144 views
1 answer 171 views
1 answer 138 views
2 answers 180 views
1 answer 165 views
165 views asked Jul 26, 2020 by avibootz
1 answer 150 views
...