SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 74 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. process.stdin.on('data', (age) => {
  6.   let date = new Date().getFullYear();
  7.   if (age <= 99 && age > 0) {
  8.     let dateOfBirth = date - age;
  9.     console.log(`Vous êtes né(e) en ${dateOfBirth}`)
  10.   } else if (isNaN(age)) {
  11.      console.log(`Veuillez entrer un nombre !`)
  12.   } else {
  13.     console.log(`OMG !!!! Vous êtes trop vieux !`)
  14.   }
  15.   process.exit()
  16. })
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