Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  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. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement