Advertisement
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 ?')
- process.stdin.on('data', (text) => {
- if (text < 0 || text > 99 ){
- console.log('Is not possible!');
- process.exit()
- }
- else if (isNaN(text)) {
- console.log("Is not a number");
- process.exit()
- }
- else {
- console.log('You are born in ' + (2019 - text) + '.');
- process.exit()
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement