-
-
Save parzibyte/51ad1b7fb85aac5e9b917de6a0377fec to your computer and use it in GitHub Desktop.
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
const contarVocales = palabra => { | |
// https://parzibyte.me/blog | |
const vocales = "aáeéiíoóuú"; | |
let cantidadVocales = 0; | |
for (const letra of palabra) { | |
if (vocales.includes(letra.toLowerCase())) { | |
cantidadVocales++; | |
} | |
} | |
return cantidadVocales; | |
}; | |
const cadena = "Hola mundo. Estoy estudiando programación en JavaScript desde el blog de Parzibyte"; | |
const vocales = contarVocales(cadena); | |
console.log("La cadena '%s' tiene %d vocales", cadena, vocales); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment