curriculum/challenges/english/blocks/workshop-sentence-analyzer/66e2df8c5676fe51cead8ec8.md
Now it is time to test your getVowelCount function.
Create a vowelCount variable and assign it the result of calling the getVowelCount function with the argument of "Apples are tasty fruits"
After that, log the following to the console: "Vowel Count: [vowel count goes here]". Replace [vowel count goes here] with the actual variable name. You can choose to use template strings or string concatenation with the + operator here.
You should create a vowelCount variable.
assert.isNotNull(vowelCount)
Your vowelCount variable should be set to the result of getVowelCount("Apples are tasty fruits").
assert.equal(vowelCount, getVowelCount("Apples are tasty fruits"));
You should log the vowelCount variable to the console with the parameter "Vowel Count: ${vowelCount}".
assert.match(code, /console\.log\((?:('|"|`)Vowel\s+Count:\s+('|"|`)\s+\+\s+vowelCount|`Vowel\s+Count:\s+\${vowelCount}`)\);?/)
function getVowelCount(sentence) {
const vowels = "aeiou";
let count = 0;
for (const char of sentence.toLowerCase()) {
if (vowels.includes(char)) {
count++;
}
}
return count;
}
--fcc-editable-region--
--fcc-editable-region--