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', (text) => {
- let annee = new Date().getFullYear();
- let calcul;
- if (isNaN(text)){
- console.log("Please use only numeric value");
- } else if(text <= 0 || text >= 99){
- console.log("Please enter a number between 1 and 99.")
- } else {
- calcul = annee - text;
- console.log("Your year of birth is "+ calcul+" .");
- }
- process.exit()
- })
Add Comment
Please, Sign In to add comment