Guest User

Untitled

a guest
Oct 18th, 2019
83
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. process.stdin.resume()
  2. process.stdin.setEncoding('utf8')
  3.  
  4. console.log('What\'s your age ? ')
  5. process.stdin.on('data',function dateOfBirth(age) {
  6. let year = 2019 - age;
  7. if (age <= 99 && age >= 0) {
  8. console.log(`Date of year : ${year}`)
  9. }
  10. else console.log(`Age can't exceed 99years old and can't be negative`)
  11.  
  12. process.exit()
  13. })
RAW Paste Data