Skip to content

Instantly share code, notes, and snippets.

@johnstew
Created February 14, 2013 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnstew/4955736 to your computer and use it in GitHub Desktop.
Save johnstew/4955736 to your computer and use it in GitHub Desktop.
Coderbyte challenge. 5 minute vowel counter.
function VowelCount(str) {
var temp = str.split("");
var vowelcount = 0;
function Compare(value) {
var vowels = ["a", "e", "i", "o", "u"];
for (i = 0; i <= vowels.length - 1; i++) {
if (value == vowels[i]) vowelcount++;
}
}
temp.forEach(Compare);
// code goes here
return vowelcount;
}
document.write(VowelCount("aeiou"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment