alexandrecoin
4/8/2018 - 10:57 AM

nodejs_1.js

process.stdin.resume()
process.stdin.setEncoding('utf8')

console.log('What\'s your age ? ')

process.stdin.on('data', function (age) {
    if (isNaN(age)) {
        console.log('This is not a number');
    } else if (age > 99) {
        console.log('You are way too old for this script !')
    } else {
        console.log('You were born in : ', 2017 - age)
        process.exit()
    };
})