Skip to content

Instantly share code, notes, and snippets.

@BastienSaulnier
Created October 2, 2019 07:47
Show Gist options
  • Save BastienSaulnier/3fc17c60542842b6c7d2dcc0b663f176 to your computer and use it in GitHub Desktop.
Save BastienSaulnier/3fc17c60542842b6c7d2dcc0b663f176 to your computer and use it in GitHub Desktop.
Wild Code School - Découverte de NodeJS
process.stdin.resume()
process.stdin.setEncoding('utf8')
console.log('What\'s your age ? (must be a number, and under 99)')
process.stdin.on('data', (text) => {
if (text <= 99 && text > 0) {
text = 2019 - text;
console.log('You are born in ' + text)
} else {
console.log('Please enter a valid value')
}
process.exit()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment