Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 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', function(age) {
  6. if (isNaN(age)) {
  7. console.log ('Not a Number!')
  8. }else{
  9. if( (age > 0) && (age < 99) ){
  10. console.log('Your year of birth is ' + (2019 - age) )
  11. } else {
  12. console.log('Try again')
  13. }}
  14. process.exit()
  15. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement