Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- process.stdin.resume()
- process.stdin.setEncoding('utf8')
- console.log('Quel est ton âge ?')
- process.stdin.on('data', (age) => {
- const currentYear = 2019;
- if (isNaN(age) || age > 99 || age > currentYear) {
- if (isNaN(age)) console.log('Merci de bien vouloir rentrer un chiffre !');
- if (age > 99) console.log('Merci de bien vouloir rentrer un nombre inférieur ou égal à 99');
- if (age > currentYear) console.log('Vous êtes un vampire ?!');
- } else {
- console.log('Vous êtes né en '+ (currentYear - age))
- process.exit()
- }})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement