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', (age) => {
- const currentDate = new Date();
- const currentYear = currentDate.getFullYear();
- let year;
- if (!isNaN(age))
- year = parseInt(age)
- if (year !=null)
- if (age < 99) {
- let calculAnnee = currentYear - age;
- console.log(calculAnnee)
- } else {
- AskAge(age);
- }
- process.exit()
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement