Guest User

Untitled

a guest
Mar 21st, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. process.stdin.resume()
  2. process.stdin.setEncoding('utf8')
  3.  
  4. console.log('What\'s your age ? ')
  5. process.stdin.on('data', (text) => {
  6. let annee = new Date().getFullYear();
  7. let calcul;
  8. if (isNaN(text)){
  9. console.log("Please use only numeric value");
  10. } else if(text <= 0 || text >= 99){
  11. console.log("Please enter a number between 1 and 99.")
  12. } else {
  13. calcul = annee - text;
  14. console.log("Your year of birth is "+ calcul+" .");
  15. }
  16. process.exit()
  17. })
Add Comment
Please, Sign In to add comment