Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. process.stdin.resume()
  2. process.stdin.setEncoding('utf8')
  3.  
  4. console.log('How old are you ?')
  5. process.stdin.on('data', (age) => {
  6. if(isNaN(age)){
  7. return console.log(`${age} is not a number`)
  8. } else if (age > 99) {
  9. return console.log('your age can\'t be over 99')
  10. } else {
  11. console.log('You were born in ' + (2019 - age))
  12. }
  13. process.exit()
  14. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement