Build a Sentence Analyzer - Step 5

Tell us what’s happening:

The code is absolutely correct as suggested by Gemini but it is not getting accepted

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}`);

function getConsonantCount(sentence) {
  const consonants = "bcdfghjklmnpqrstvwxyz";
  let count = 0;

  for (const char of sentence.toLowerCase()) {
    if (consonants.includes(char)) {
      count++;
    }
  }
  return count;
}

const consonantCount = getConsonantCount("Coding is fun");
console.log(`Consonant Count: ${consonantCount}`);


// User Editable Region

const getPunctuationCount = (sentence) =>{
  let count = 0;
  for (const char of sentence.toLowerCase()){
    
    if(!(vowels.includes(char)) && !(consonants.includes(char)) && char !== ' '){
      count ++
    }
  }
  return count
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36

Challenge Information:

Build a Sentence Analyzer - Step 5
https://www.freecodecamp.org/learn/full-stack-developer/workshop-sentence-analyzer/step-5

that’s not a good idea, if someone else writes your code you are not going to learn as efficiently

try calling your function, so you can test what it returns, you will find why the tests fail