Skip to content

Instantly share code, notes, and snippets.

@MartinsAlexandre
Created April 16, 2018 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinsAlexandre/9868b2c205a281905f681542931b27d8 to your computer and use it in GitHub Desktop.
Save MartinsAlexandre/9868b2c205a281905f681542931b27d8 to your computer and use it in GitHub Desktop.
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