Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 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', (num) => {
  6. num = parseInt(num)
  7. if(typeof(num) == 'string'|| isNaN(num) == true || (2019-num) >= 2019){
  8. console.log('The value is incorrect')
  9. }else if (num > 99){
  10. console.log('You can\'t be this old, time to DIE')
  11. }else{
  12. console.log('You are born in ' + (2019-num))
  13. }
  14. process.exit()
  15. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement