Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- process.stdin.resume()
- process.stdin.setEncoding("utf8")
- console.log("What's your age ? ")
- process.stdin.on("data", age => {
- const year = 2018
- const yOb = year - age
- if (age < 99 && Number.isInteger(yOb) && age > 0) {
- console.log(yOb)
- } else {
- console.log("Wrong entry, please input a correct number")
- }
- process.exit()
- })
Add Comment
Please, Sign In to add comment