Count vowels

Write a function countVowels(str), which takes a string str as an input. This function should return the total number of vowels in str.

Instructions

  • Return 0 if str has no vowels.
  • Assume that str may contain any alphanumeric characters.

Example test cases

countVowels("Hello world!"); // Output: 3 countVowels("This is a test"); // Output: 4 countVowels("No vowels here"); // Output: 0
Adding your container request
Getting your dedicated container
Connecting to your container
Setting up your editor
Finalizing your playground
TerminalEditorBrowser