Last active
November 23, 2019 20:34
-
-
Save ealipio/ba72d94e20e26ed549a88f416854e112 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 readline = require('readline'); | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}); | |
const printMessagetoUser = ({name, age}) => { | |
if (!isNaN(age)) { | |
const yearOf100 = new Date().getFullYear() + (100 - age); | |
if (age > 100) { | |
console.log( `Lo lamento ${name} tu ya cumpliste cien hace ${age - 100} anhios.`); | |
} else { | |
console.log(`Hola ${name}, en el ${yearOf100} tendras 100 anhios`); | |
} | |
} else { | |
console.log(`debes ingresar un numero parfavar`); | |
} | |
} | |
rl.question('Cual es tu nombre? ', name => { | |
rl.question('Cual es tu edad? ', age => { | |
printMessagetoUser({ name, age }); | |
rl.close(); | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment