The Sky Guard

EasyAcc. 97.8%
+15 XP 5

Two Paths, One Choice

Every story has two sides. In programming, the else block represents the "alternative timeline." If the first condition fails, your code takes the backup path.

The Assignment

Your function receives a boolean parameter named isRaining.

  1. Build a destiny-decider using if-else:
    • If isRaining is true, protect the user by printing: "Bring an umbrella."
    • Otherwise (the else path), let them roam free by printing: "Enjoy the sunshine!"

01EXAMPLE 1

InputisRaining = true
OutputLogs: "Bring an umbrella."

Explanation: Condition is true, so the first block runs.

02EXAMPLE 2

InputisRaining = false
OutputLogs: "Enjoy the sunshine!"

Explanation: Condition is false, so the else block runs.

Constraints

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

Input Arguments

isRainingtrue

Expected Output

Bring an umbrella.

Click RUN to test your solution