Skip to content

Instantly share code, notes, and snippets.

@cplpearce
Created August 8, 2020 02:41
Show Gist options
  • Save cplpearce/f41a1ee7260defb65e3ddd9535459cef to your computer and use it in GitHub Desktop.
Save cplpearce/f41a1ee7260defb65e3ddd9535459cef to your computer and use it in GitHub Desktop.
Kata 3 - Vowels
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