Build a Sentence Analyzer - Step 3

Tell us what’s happening:

Am getting a message that “my function should return the correct consonant count for any sentence” yet the function works well. Please help me review my code

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
  const consonants = "cdfghjklmnpqrstvwxyz"
  for (const char of sentence.toLowerCase()  ) {
   if (consonants.includes(char)) {
    count++
   }
  }
  return count
}
console.log(getConsonantCount ("Tommy"))

// 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/147.0.0.0 Safari/537.36

Challenge Information:

Build a Sentence Analyzer - Step 3

Hi

You have missed a consonant here:

  const consonants = "cdfghjklmnpqrstvwxyz"