Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function vowelsSum(input) {
- let text = input[0];
- let sum = 0;
- for (let index = 0; index < text.length; index++) {
- let symbol = text.charAt(index);
- switch (symbol) {
- case "a":
- sum += 1;
- break;
- case "e":
- sum += 2;
- break;
- case "i":
- sum += 3;
- break;
- case "o":
- sum += 4;
- break;
- case "u":
- sum += 5;
- break;
- }
- //console.log(text.charAt(index))
- }
- console.log(sum);
- }
- vowelsSum(["hello"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement