Created
April 8, 2019 09:10
-
-
Save dragonslayer77/8458ba0f739b672cc36432eba10ec541 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') | |
const currentYear = new Date().getFullYear(); | |
const birthYear = (age) => { | |
if (age.isNaN || age > 99) { | |
} else{ | |
let numYears = currentYear - age; | |
if (numYears < currentYear) { | |
return numYears; | |
} | |
} | |
}; | |
console.log('How old are you ? ') | |
process.stdin.on('data', (number) => { | |
console.log('You were born in the year ' + birthYear(number)); | |
process.exit() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment