daily pastebin goal
31%
SHARE
TWEET

Untitled

a guest Mar 23rd, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const inputScanner = process.stdin
  2. const outputScanner = process.stdout
  3. inputScanner.setEncoding('utf8')
  4.  
  5. const findBirthYear = () => {
  6.     outputScanner.write("Enter your age > ")
  7.     inputScanner.on('data', age => {
  8.         currentYear = 2019
  9.         if (Number(age) && typeof Number(age) === "number" && age <= 99) {
  10.             console.log(`Ton année de naissance: ${currentYear - age}`)
  11.             process.exit()
  12.  
  13.         } else {
  14.             console.log("* Ton valeur ne peut être que un numérique. \n* Ton valeur ne peut pas être supérieure à 99.")
  15.             process.exit()
  16.         }
  17.     })
  18. }
  19.  
  20. findBirthYear()
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