SHARE
TWEET

Untitled

a guest Oct 18th, 2019 77 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('How old are you ? ')
  5. process.stdin.on('data', (nb) => {
  6.   nb = parseInt(nb)
  7.   if ((isNaN(nb) === true) || ((2019-nb) >= 2019) || (nb > 99)) {
  8.     console.log('Please enter a number under 99')
  9.   } else {
  10.     console.log(`You were born in ${2019 - nb}`)
  11.   }
  12.   process.exit()
  13. })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top