SHARE
TWEET

Untitled

a guest Oct 19th, 2019 100 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('Quel est ton âge ?')
  5.  
  6. process.stdin.on('data', (age) => {
  7.     const currentYear = 2019;
  8.     if (isNaN(age) || age > 99 || age > currentYear) {
  9.         if (isNaN(age)) console.log('Merci de bien vouloir rentrer un chiffre !');
  10.         if (age > 99) console.log('Merci de bien vouloir rentrer un nombre inférieur ou égal à 99');
  11.         if (age > currentYear) console.log('Vous êtes un vampire ?!');
  12.     } else {
  13.   console.log('Vous êtes né en '+ (currentYear - age))
  14.   process.exit()
  15. }})
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