Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Vowel Count with IndexOf
var withIndex = function (s) {
var vowels = 0;
var vowelArray = ["a","e","i","o","u"];
for (var i = 0; i < s.length-1; i++){
if (vowelArray.indexOf(s[i].toLowerCase()) !== -1 ) {
vowels++;
}
}
return vowels;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment