Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- const readline = require('readline');
- const rl = readline.createInterface({
- input: process.stdin,
- output: process.stdout
- });
- function determineAgeGroup(age) {
- if (age >= 0 && age <= 2) {
- console.log("baby");
- } else if (age >= 3 && age <= 13) {
- console.log("child");
- } else if (age >= 14 && age <= 19) {
- console.log("teenager");
- } else if (age >= 20 && age <= 65) {
- console.log("adult");
- } else if (age >= 66) {
- console.log("elder");
- } else {
- console.log("out of bounds");
- }
- rl.question('Press any key to continue...', () => {
- rl.close();
- });
- }
- rl.question('', (age) => {
- determineAgeGroup(parseInt(age));
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement