Have to debug a certain segment of code for this class and I can't figure out why this JS counts all letters and not just vowels.
var text, i, sLength, myChar;
var count;
var text = prompt("Type a phrase please"); //put var in front of text and fixed " in place of ' in front of type
count = 0;
for (i = 1; i <= text.length; i+= 1){
myChar = text[i];
if (myChar == 'a' || 'o' || 'e' || 'u'){ //switched to the proper vowels
count += 1;
console.log('Vowel:', myChar);
}
console.log(myChar, count);
}
alert (count); //put the count in () instead of alert