The Ghost Signal
MediumAcc. 90.2%
+20 XP 8
The Whispering Logic
In professional code, you don't always need a heavy if statement. You can use the Short-Circuit AND (&&) to execute a command only if the condition is true. If the first part is false, JavaScript ignores the second part entirely.
The Assignment
Your function receives a boolean parameter named debugMode.
- Write a single line of code using
&&:- If
debugModeis true, useconsole.log()to print: "Debugging log activated." - If it is false, nothing should happen.
- If
01EXAMPLE 1
Input
debugMode = trueOutput
Logs: "Debugging log activated."Explanation: Short-circuit allows the log to run.
02EXAMPLE 2
Input
debugMode = falseOutput
No outputExplanation: Condition is false, so the log is skipped.
Constraints
- Use the && operator for shorthand logic.
- Do not use a traditional if statement.
- Log message must match exactly.
Control FlowConditionalsLogic
JavaScriptSystem handles I/O — write your function only
Loading...
4 Hidden
Input Arguments
debugModetrue
Expected Output
Debugging log activated.
Click RUN to test your solution