Beginner
Using if statements to determine age groups
Description
In this challenge, you need to write a function that takes a person's age as input and returns the corresponding age group category based on the following rules:
- If the age is 0 to 12, return "Child".
- If the age is 13 to 19, return "Teenager".
- If the age is 20 to 64, return "Adult".
- If the age is 65 or above, return "Senior".
This challenge will help you understand how to use 'if' statements to implement logic based on conditions.
Example Usage
determineAgeGroup(16); // ➞ "Teenager"determineAgeGroup(45); // ➞ "Adult"determineAgeGroup(70); // ➞ "Senior"
Constraints
- The input will always be a non-negative integer.
- The function should return a string corresponding to the age group.
- Edge cases such as exactly 12, 13, 19, 20, 64, and 65 should be handled correctly.
Did you know?
TypeScript is not a language, it is a superset of JavaScript.
Test Cases
Input:
13
Expected Output:
"Teenager"