Build a Sentence Analyzer - Step 1

Tell us what’s happening:

Gives this error :
7. Your getVowelCount function should return the correct vowel count for any sentence.

I don’t understand what’s wrong with my code.

Your code so far


// User Editable Region

const getVowelCount = sentence => {
  const vowels = "aeiouy";

  let count = 0
  for (let char of sentence) {
    if (vowels.includes(char)) count++;
  }
  return count;
}
console.log(getVowelCount("Apples are tasty fruits"));

// 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 1

hello @gogsyan11 welcome to the forum!

Is “y”” a vowel? If you do console.log(getVowelCount(“Apples”)), does it return 2?