Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- process.stdin.resume()
- process.stdin.setEncoding('utf8')
- const dateNow = 2019;
- console.log('How old are you ?')
- process.stdin.on('data', (age) => {
- let birthDate
- if (isNaN(age) === false && age < 99 && age < dateNow) {
- birthDate = dateNow - age;
- console.log('You was born in ' + birthDate);
- } else {
- console.log('Try again');
- }
- process.exit()
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement