Created
April 16, 2018 13:34
-
-
Save MartinsAlexandre/9868b2c205a281905f681542931b27d8 to your computer and use it in GitHub Desktop.
This file contains 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
process.stdin.resume() | |
process.stdin.setEncoding('utf8') | |
console.log('What\'s your age ? ') | |
process.stdin.on('data', (number) => { | |
if (!isNaN(number) && number < 99) { | |
calcul(number); | |
} | |
function calcul(number) { | |
let annee = 2018 - number; | |
return console.log('Votre année de naissance est ' + annee); | |
} | |
process.exit() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment