Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- process.stdin.resume()
- process.stdin.setEncoding('utf8')
- console.log('What\'s your age ? ')
- process.stdin.on('data', (userAge) => {
- const year = 2018
- const yOb = year - userAge
- if (userAge >=0 && userAge <= 99 && Number.isInteger(yOb)) {
- console.log("Your year of birth is" + " " + yOb)
- } else {
- console.log("Wrong Entry")
- }
- process.exit()
- })
Add Comment
Please, Sign In to add comment