Guest User

Untitled

a guest
Apr 24th, 2018
81
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', (birthday) => {
  6. if (!isNaN(birthday) && birthday < 99) {
  7. console.log('Your year of birth is ' + (2018 - birthday))
  8. process.exit()
  9. } else {
  10. console.log('Please enter your real age');
  11. process.exit()
  12. }
  13. })
Add Comment
Please, Sign In to add comment