Advertisement
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) => {
- if(isNaN(age)==true)
- {
- console.log("This is not an age!")
- } else{
- if(age>99 || age==0)
- {
- console.log("Your age must be less than 99 and greater than 0")
- }
- else{
- console.log('You were born in ' + (2019 - age))
- }
- }
- process.exit()
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement