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) || age > 99){
- console.log('You must enter a NUMBER under 99. ');
- process.exit()
- } else {
- const birthYear = new Date().getFullYear() - age;
- console.log('You were born in '+ birthYear);
- process.exit()
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement