//To count the number of vowel characters in a string using JavaScript
let message = 'Hello w0rld';
let vowels ='aeiou'
let count=0
//solution 1
for(let chr of message){
if(vowels.includes(chr)){
count = count+1;
}
}
console.log("Solution1: " + count);
//solution 2
function countVowels(data){
let count=0;
data.split('').forEach(x=>{
if(vowels.includes(x)){
count = count+1;
}
});
return count;
}
let countVowel = countVowels(message);
console.log("Solution2: " + countVowel);