Skip to content

Instantly share code, notes, and snippets.

@calderonroberto
Created November 20, 2015 06:25
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save calderonroberto/ee37f116f91e0390d454 to your computer and use it in GitHub Desktop.
Vowel count with if
var withIf = function (s) {
var vowels = 0;
for (var i=0; i < s.length-1; i++){
var letter = s[i].toLowerCase();
if (letter === "a" || letter === "e" || letter === "i" || letter === "o" || letter === "u" ){
vowels++;
}
}
return vowels;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment