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.

  1. Use a switch statement 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

InputdayNumber = 3
OutputLogs: "Tuesday"

Explanation: The dial matches case 3.

02EXAMPLE 2

InputdayNumber = 2
OutputLogs: "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
JavaScript
Loading...
4 Hidden

Input Arguments

dayNumber3

Expected Output

Tuesday

Click RUN to test your solution