Count Vowels
This function should take a string as an input and return the count of vowels (a, e, i, o, u) in the string. The function should be case-insensitive.
Input: String (string).
Output: Integer (number).
Examples:
assert.strictEqual(countVowels("hello"), 2);
assert.strictEqual(countVowels("openai"), 4);
assert.strictEqual(countVowels("typescript"), 2);
assert.strictEqual(countVowels("a"), 1);
How it’s used:
- in natural language processing tasks, like text analysis and statistics;
- in text-based games or learning applications, for instance, to calculate the difficulty level of a word or phrase.
Preconditions:
- text ∈ string;
- length(text) >= 0.