Build a Sentence Analyzer - Step 1

Tell us what’s happening:

  1. Your getVowelCount function should return the correct vowel count for any sentence.

Hi and sorry for the inconvenience but someone can help me?

Your code so far


// User Editable Region

function getVowelCount(sentence) {
  const vowel = ["a", "e", "i", "o", "u", "y"];
  let count = 0;

  for (let char of sentence) {
    if (vowel.includes(char)) {
      count++ ;
    }
  }

return count;
};

let a = getVowelCount("aeiouy. AEIOUY.");
console.log(a); //6

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

Challenge Information:

Build a Sentence Analyzer - Step 1

Hi.

“y” is not a vowel.

Your function doesn’t account for upper case letters.

Thank you. I’m french and “y” is a vowel in french language. I update my array and pass the step 1. Have a good day.

[mod edit - solution removed]

Hi

Good to hear you have resolved it.

I have removed the solution from your post as we guide users to work out the answer for themselves.