Skip to content

Instantly share code, notes, and snippets.

@brendaMan
Last active April 4, 2019 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save brendaMan/fea6a03e503befc39fbdc01083f204a4 to your computer and use it in GitHub Desktop.
Save brendaMan/fea6a03e503befc39fbdc01083f204a4 to your computer and use it in GitHub Desktop.
NodeJS
process.stdin.resume()
process.stdin.setEncoding('utf8')
console.log('How old are you ? ')
process.stdin.on('data', (age) => {
console.log('You are ' + age.trim() + ' years old ')
if (age > 99){
console.log('Too old!!')
} else {
var birth = 2019 - age;
console.log('You were born in ' + birth)
process.exit()}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment