display vovels and other alphabets in the string javascript code example
Example 1: how to make a vowel counter in javascript
const vowelCount = str => {
let vowels = /[aeiou]/gi;
let result = str.match(vowels);
let count = result.length;
console.log(count);
};
Example 2: count vowels in a string javascript
// BEST and FASTER implementation using regex
const countVowels = (str) => (str.match(/[aeiou]/gi) || []).length