Back to Freecodecamp

Step 1

curriculum/challenges/english/blocks/workshop-sentence-analyzer/66e2d680e129e1423116a541.md

latest1.6 KB
Original Source

--description--

In this workshop, you will build a sentence analyzer that will take a sentence and get the count for the number of words, vowels, consonants, and punctuation marks.

To begin, create a getVowelCount function with a parameter called sentence. Your function should return the total number of vowels in a sentence.

--hints--

You should create a getVowelCount function.

js
assert.isFunction(getVowelCount);

Your getVowelCount function should have a sentence parameter.

js
assert.match(getVowelCount.toString(), /sentence/);

Your getVowelCount function should return a number.

js
assert.isNumber(getVowelCount("Apples are tasty fruits"))

When the sentence is "Apples are tasty fruits", the getVowelCount function should return 7.

js
assert.strictEqual(getVowelCount("Apples are tasty fruits"), 7);

When the sentence is "Hello, World!", the function should return 3.

js
assert.strictEqual(getVowelCount("Hello, World!"), 3);

Your vowel count should be case-insensitive.

js
assert.strictEqual(getVowelCount("Apples are tasty fruits"), 7);
assert.strictEqual(getVowelCount("freeCodeCamp is awesome"), 10);

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

js
assert.strictEqual(getVowelCount("I went to the store"), 6);
assert.strictEqual(getVowelCount("The quick brown fox jumps over the lazy dog"), 11);
assert.strictEqual(getVowelCount("The cat in the hat"), 5);
assert.strictEqual(getVowelCount(""), 0);

--seed--

--seed-contents--

js
--fcc-editable-region--

--fcc-editable-region--