Created
August 8, 2020 02:41
-
-
Save cplpearce/f41a1ee7260defb65e3ddd9535459cef to your computer and use it in GitHub Desktop.
Kata 3 - Vowels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const numberOfVowels = function(data) { | |
let count = 0; | |
for (let char of data) { | |
switch(char) { | |
case "a": | |
count++; | |
break; | |
case "e": | |
count++; | |
break; | |
case "i": | |
count++; | |
break; | |
case "o": | |
count++; | |
break; | |
case "u": | |
count++; | |
break; | |
default: | |
break; | |
} | |
} | |
return count; | |
}; | |
console.log(numberOfVowels("orange")); | |
console.log(numberOfVowels("lighthouse labs")); | |
console.log(numberOfVowels("aeiou")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment