-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCuenta Vocales.js
More file actions
32 lines (28 loc) · 849 Bytes
/
Cuenta Vocales.js
File metadata and controls
32 lines (28 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Author: Manel Benlloch - 15/10/2018
// Windows CMD Spanish Configuration, command: chcp 65001
const rl=require("readline-sync");
let a=0;let e=0;let i=0;let o=0;let u=0;
let textVAR=rl.question("Introduce un texto aqui: ");
for (let x = 0; x<= textVAR.length; x++) {
// console.log(textVAR.charAt(x));
if(textVAR.charAt(x)==="a"){
a=a+1;
}
if(textVAR.charAt(x)==="e"){
e=e+1;
}
if(textVAR.charAt(x)==="i"){
i=i+1;
}
if(textVAR.charAt(x)==="o"){
o=o+1;
}
if(textVAR.charAt(x)==="u"){
u=u+1;
}
}
console.log("El texto Contiene: "+ a+" - Letras a");
console.log("El texto Contiene: "+ e+" - Letras e");
console.log("El texto Contiene: "+ i+" - Letras i");
console.log("El texto Contiene: "+ o+" - Letras o");
console.log("El texto Contiene: "+ u+" - Letras u");