SHARE
TWEET

Untitled

a guest Oct 19th, 2019 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. process.stdin.resume()
  2. process.stdin.setEncoding('utf8')
  3. console.log('What\'s your age ? ')
  4. process.stdin.on('data', (age) => {
  5.  if (isNaN(age) || age > 99){
  6.    console.log('You must enter a NUMBER under 99. ');
  7.    process.exit()
  8.  } else {
  9.    const birthYear = new Date().getFullYear() - age;
  10.    console.log('You were born in '+ birthYear);
  11.    process.exit()
  12.  }
  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