The Chronos Dial
EasyAcc. 96.5%
+15 XP 5
The Master Switch
The switch statement is like a mechanical dial. Instead of checking ranges (like 80 to 90), it looks for exact matches. It's the most efficient way to jump to a specific path when you have many individual options.
The Assignment
Your function receives a parameter dayNumber.
- Use a
switchstatement to turn the dial:- Case 1: Print "Sunday"
- Case 3: Print "Tuesday"
- Case 5: Print "Thursday"
- Default (any other number): Print "A weekday."
01EXAMPLE 1
Input
dayNumber = 3Output
Logs: "Tuesday"Explanation: The dial matches case 3.
02EXAMPLE 2
Input
dayNumber = 2Output
Logs: "A weekday."Explanation: No case matches 2, so it hits the default.
Constraints
- Use a switch statement.
- Always include the break keyword for your cases.
- Log messages must match exactly.
Control FlowConditionalsFundamentals
JavaScriptSystem handles I/O — write your function only
Loading...
4 Hidden
Input Arguments
dayNumber3
Expected Output
Tuesday
Click RUN to test your solution