Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. process.stdin.resume()
  2. process.stdin.setEncoding('utf8')
  3.  
  4. console.log('What\'s your age ? ')
  5. process.stdin.on('data', (age) => {
  6.  
  7. if((0>=age||age>99)||(isNaN(age))) {
  8. console.log ("invalid data")
  9. }
  10. else {
  11. console.log('You was born in ' + (2019 - age))}
  12. process.exit()
  13. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement