Skip to content

Instantly share code, notes, and snippets.

@Nocktiss
Created March 19, 2019 09:24
Show Gist options
  • Save Nocktiss/54ffc6bec3ab5173c9c19e7348ae3747 to your computer and use it in GitHub Desktop.
Save Nocktiss/54ffc6bec3ab5173c9c19e7348ae3747 to your computer and use it in GitHub Desktop.
Quete_NodeJS
process.stdin.resume()
process.stdin.setEncoding('utf8')
console.log('Quel âge as-tu ?')
process.stdin.on('data', (number, birth) => {
if (number > 0 && number < 99) {
birth = 2018 - number;
console.log('Tu es né(e) en ' + birth);
} else if (number > 99) {
console.log('Centenaire, la classe !')
} else {
console.log('Ce n\'est pas un chiffre')
}
process.exit()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment