← All Exercises

Vowel Counter

basicjavascript~10min

Background

Vowel counting is a simple text analysis task useful in linguistics and string manipulation exercises.

Problem

Write a function that takes a string and returns the count of vowel characters (a, e, i, o, u), ignoring case.

Input

A string of zero or more characters.

Output

A non-negative integer representing the vowel count.

Sample tests

Sample 1

Input: "Hello World"
Expected: 3

Your solution

Learning objective

Learn regex matching with global and case-insensitive flags in JavaScript.