Recursion: Count Vowels

Published by Matt in

Write a function that recursively returns the number of vowels in a string.

Examples

countVowels("apple") ➞ 2

countVowels("cheesecake") ➞ 5

countVowels("bbb") ➞ 0

countVowels("") ➞ 0

Notes

  • All letters will be in lower case.
  • Vowels are: a, e, i, o, u.
Watch a quick demo on how Edabit works.