SHARE
TWEET

Untitled

a guest Mar 23rd, 2019 82 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', (age) => {
  6.     let birthDate = 0;
  7.     if(isNaN(age)) {
  8.         console.log('Not a integer !');
  9.         process.exit()
  10.      } else {
  11.         if(age > 99 && age < 0) {
  12.             console.log('Error');
  13.         } else {
  14.         birthDate = 2019 - age;
  15.         console.log('Your birth is: ', birthDate);
  16.         process.exit()
  17.         }
  18.     return birthDate;
  19.   }
  20. })
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