I am trying to count the number of vowels in a string, but my counter does not seem to be returning more than one. Can someone please tell me what is wrong with my code? Tha
You need to also do this. use toLowerCase() also
var vowelCount = function(str){
var count = 0;
for(var i = 0; i < str.length; i++){
if(str[i].toLowerCase() == 'a' || str[i].toLowerCase() == 'i' || str[i].toLowerCase() == 'o' ||str[i].toLowerCase() == 'e' ||str[i].toLowerCase() == 'u'){
count+=1;
}
}
return count;
}
vowelCount('aide')