Question Bank

JavaScript Vowel Counting: Three Approaches Quiz

Difficulty: Medium

Count vowels in a string three different ways (loop + Set lookup, split + forEach, regex match) plus two companion drills on case sensitivity and big-O analysis.

Question Bank
/

JavaScript Vowel Counting: Three Approaches Quiz

JavaScript Vowel Counting: Three Approaches Quiz

Count vowels in a string three different ways (loop + Set lookup, split + forEach, regex match) plus two companion drills on case sensitivity and big-O analysis.

Question Bank
Medium
JavaScript
5 questions
quiz
strings
string-manipulation
interview-prep

473 views

7

Implement findVowels(str) using a loop and an explicit vowel-set lookup. The function should be case-insensitive and return the total count of a, e, i, o, u.

Examples

Example 1:

Input: 'hello'
Output: 2
Explanation: 'e' and 'o' are vowels.

Example 2:

Input: 'BCDFG'
Output: 0
Explanation: No vowels in any case, so the count is 0.