Tell us what’s happening:
I don’t understand why there is an error with the if bracket, could you help a little? Thanks.
Your code so far
function getVowelCount(sentence) {
const vowels = "aeiou";
let count = 0;
for (const char of sentence.toLowerCase()) {
if (vowels.includes(char)) {
count++;
}
}
return count;
}
const vowelCount = getVowelCount("Apples are tasty fruits");
console.log(`Vowel Count: ${vowelCount}`);
// User Editable Region
function getConsonantCount(sentence){
let count = 0;
for (const char of sentence.toLowerCase()){
if (char != "a" || char != "e" || char != "i" || char != "o" || char != "u" ||) {
count++;
}else{console.log("Errorrrrrr")}
return count;
}
}
console.log(getConsonantCount("Coding is fun"))
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0
Challenge Information:
Build a Sentence Analyzer - Step 3