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