SHARE
TWEET

Untitled

a guest Oct 19th, 2019 96 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 âge as-tu ?")
  5.  
  6. process.stdin.on('data', (old) => {
  7.     let newDate = new Date();
  8.     let currentYear = newDate.getFullYear()
  9.     let birthYear = currentYear - old;
  10.  
  11.     if(isNaN(old) == false && old < 100 && old >= 0){
  12.         console.log("Tu es né(e) en : " + birthYear)  
  13.     } else
  14.         console.log("L'entrée ne fonctionne pas...");
  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