Created
February 14, 2013 19:45
-
-
Save johnstew/4955736 to your computer and use it in GitHub Desktop.
Coderbyte challenge. 5 minute vowel counter.
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
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