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', function(myAge) {
- if (isNaN(Number(myAge))) {
- console.log(myAge + ' is not a number ..');
- } else if ( myAge > 99 ) {
- console.log( 'You are too old !!' )
- } else if ( ( myAge < 99 ) && ( myAge > 0) ) {
- var year = new Date().getFullYear();
- var birth = year - myAge;
- console.log( 'You were born in ' + birth + ' !' )
- }
- process.exit()
- });
Add Comment
Please, Sign In to add comment