Skip to content

Latest commit

 

History

History

12

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

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