Skip to content

Instantly share code, notes, and snippets.

@MkLHX
Created January 31, 2017 13:38
Show Gist options
  • Save MkLHX/e36225199bc1134775f5222a7e5c4fc6 to your computer and use it in GitHub Desktop.
Save MkLHX/e36225199bc1134775f5222a7e5c4fc6 to your computer and use it in GitHub Desktop.
process.stdin.resume()
process.stdin.setEncoding('utf8')
console.log('How old are you? ')
var age = 0;
process.stdin.on('data', (age) => {
if(!isNaN(age) && age < 99 && age > 0){
bothYear = 2017-age
console.log('You\'re both in ' + bothYear)
}else {
console.log('Please enter number when give you\'re age or check you entered a correct age')
}
process.exit()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment