Created
March 2, 2019 14:11
-
-
Save jamile-dev/3b1df4b0553d5d95db3268f3936a6a47 to your computer and use it in GitHub Desktop.
Descobrir a quantidade de vogais de uma frase
This file contains hidden or 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
const countVowels = (...words) => { | |
let vowels = 0; | |
for( word of words ) { | |
let wordsInLoweCase = word.toLowerCase(); | |
const letters = [...wordsInLoweCase]; | |
for( let letter of letters ) { | |
if ('aeiou'.indexOf(letter) !== -1) { | |
vowels++; | |
} | |
} | |
} | |
console.log(vowels) | |
} | |
countVowels('Contagem de vogais nas frases'); // 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment