Advertisement
Btwonu

Ages

May 30th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';
  2.  
  3. function ages(age) {
  4.   let person = '';
  5.  
  6.   if (age === 0 && age <= 2) {
  7.     person = 'baby';
  8.   } else if (age >= 3 && age <= 13) {
  9.     person = 'child';
  10.   } else if (age >= 14 && age <= 19) {
  11.     person = 'teenager';
  12.   } else if (age >= 20 && age <= 65) {
  13.     person = 'adult';
  14.   } else if (age >= 66) {
  15.     person = 'elder';
  16.   } else {
  17.     person = 'out of bounds';
  18.   }
  19.   //Output
  20.   console.log(person);
  21. }
  22.  
  23. ages(65);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement