Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- process.stdin.resume()
- process.stdin.setEncoding("utf8")
- console.log("How old are you, my dear ?")
- process.stdin.on("data", (age) => {
- const thisYear = 2018
- let birthYear
- if (!isNaN(age)) {
- if (age <= 99 &&Â age > 0) {
- birthYear = thisYear - age
- console.log("Sooooo, you were born in " + birthYear + " !")
- } else {
- console.log("I'm pretty sure you aren't a feotus! Your age must be less or equal than 99 !")
- }
- } else {
- console.log("You must give me a whole number :) ")
- }
- process.exit()
- })
Add Comment
Please, Sign In to add comment