Skip to content

Commit

Permalink
Merge pull request mouredev#6055 from RNatsuki/main
Browse files Browse the repository at this point in the history
Reto#47 -  JavaScript
  • Loading branch information
Roswell468 authored Dec 11, 2023
2 parents caefd71 + 02523df commit 1cc8b64
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const readline = require("readline");

const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});

rl.question("Ingresa una palabra: ", (word) => {
const points = [...word].reduce((acc, char) => {
if (char === "ñ") {
return acc + 15;
} else {
const point = char.charCodeAt(0) - 96;
return acc + (point >= 15 ? point + 1 : point);
}
}, 0);

console.log(`Puntos: ${points}`);

rl.close();
});

0 comments on commit 1cc8b64

Please sign in to comment.