Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
113
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('How old are you? ')
  5. process.stdin.on('data', (age) => {
  6. if (isNaN(age)) {
  7. console.log("that is not a number");
  8. }
  9. else if (age > 99) {
  10. console.log("You're too old for this game");
  11. } else {
  12. var year = (2019 - age);
  13. console.log("you were born in " + year);
  14. }
  15. console.log("Goodbye!")
  16. process.exit()
  17. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement