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.

  1. Use a ladder of if-else if checks:
    • If level is less than lowCap, print: "Low level"
    • Otherwise, if level is midCap or less, print: "Mid level"
    • For any higher level, print: "High level"

01EXAMPLE 1

Inputlevel = 15
OutputLogs: "Mid level"

Explanation: 15 is not < 10, but it is <= 20.

02EXAMPLE 2

Inputlevel = 25
OutputLogs: "High level"

Explanation: 25 fails both range checks.

Constraints

  • Use an if-else if-else structure.
  • Log messages must match exactly.
Control FlowConditionalsFundamentals
JavaScript
Loading...
5 Hidden

Input Arguments

level15
lowCap10
midCap20

Expected Output

Mid level

Click RUN to test your solution