Skip to content

Instantly share code, notes, and snippets.

@jerzyyy
Created September 22, 2018 15:01
Show Gist options
  • Save jerzyyy/cdc31e6fc5532ba4f67549a3045b6eb5 to your computer and use it in GitHub Desktop.
Save jerzyyy/cdc31e6fc5532ba4f67549a3045b6eb5 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) => {
if (text == number && text >= 0 && text <= 99) {
console.log(2018 - text)
} else {
console.log('not valid')
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment