js countvowels code example
Example 1: how to make a vowel counter in javascript
function countVowels(str) {
return str.match(/[aeiou]/g).length;
}
Example 2: count vowels in a string javascript
// BEST and FASTER implementation using regex
const countVowels = (str) => (str.match(/[aeiou]/gi) || []).length