Skip to content

Instantly share code, notes, and snippets.

@jerzyyy
Created September 23, 2018 17:27
Show Gist options
  • Save jerzyyy/f2287570d1804b18da061829bcd7b7ac to your computer and use it in GitHub Desktop.
Save jerzyyy/f2287570d1804b18da061829bcd7b7ac to your computer and use it in GitHub Desktop.
process.stdin.resume()
process.stdin.setEncoding('utf8')
console.log('how old are you? ')
process.stdin.on('data', (text) => {
text = parseInt(text)
let date = new Date()
let year = date.getFullYear()
if (text != NaN && text >= 0 && text <= 99)
console.log(year - text)
process.exit()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment