The Adventurer's Rank
EasyAcc. 97.1%
+15 XP 5
Mastering the Sequence
When checking ranges, the order of your conditions matters! JavaScript checks them from top to bottom. If you check < 10 first, you know that anything failing that check must be 10 or higher.
The Assignment
Your function receives parameters level, lowCap, and midCap.
- Use a ladder of
if-else ifchecks:- If
levelis less thanlowCap, print: "Low level" - Otherwise, if
levelismidCapor less, print: "Mid level" - For any higher level, print: "High level"
- If
01EXAMPLE 1
Input
level = 15Output
Logs: "Mid level"Explanation: 15 is not < 10, but it is <= 20.
02EXAMPLE 2
Input
level = 25Output
Logs: "High level"Explanation: 25 fails both range checks.
Constraints
- Use an if-else if-else structure.
- Log messages must match exactly.
Control FlowConditionalsFundamentals
JavaScriptSystem handles I/O — write your function only
Loading...
5 Hidden
Input Arguments
level15
lowCap10
midCap20
Expected Output
Mid level
Click RUN to test your solution