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) => {
- if(isNaN(age)) {
- console.log('Please enter a age')}
- else if(age > 99) {
- console.log('Please enter a maximum age of 99')}
- else if(age === 0) {
- console.log('You were born on 2017')}
- else {
- console.log('You were born on ' + (2018-age))
- process.exit()
- }
- })
Add Comment
Please, Sign In to add comment