Created
September 23, 2018 17:27
-
-
Save jerzyyy/f2287570d1804b18da061829bcd7b7ac to your computer and use it in GitHub Desktop.
This file contains 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('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