SHARE
TWEET

Untitled

a guest Mar 23rd, 2019 75 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', (text) => {
  6.   if (text < 0 || text > 99 ){
  7.     console.log('Is not possible!');
  8.     process.exit()
  9.   }
  10.   else if (isNaN(text)) {
  11.     console.log("Is not a number");
  12.     process.exit()
  13.   }
  14.   else {
  15.     console.log('You are born in ' + (2019 - text) + '.');
  16.     process.exit()
  17.   }
  18. })
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