Created
October 2, 2019 07:47
-
-
Save BastienSaulnier/3fc17c60542842b6c7d2dcc0b663f176 to your computer and use it in GitHub Desktop.
Wild Code School - Découverte de NodeJS
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
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