The Number Neutralizer
EasyAcc. 98.8%
+15 XP 5
Zero: The Middle Ground
When dealing with ranges, "Zero" is often a unique edge case. By sequencing your if-else if ladder correctly, you can split reality into three distinct zones.
The Assignment
Your function receives a parameter named value.
- Write an
if-else ifladder:- If
valueis greater than 0, print: "Positive" - If
valueis less than 0, print: "Negative" - Otherwise (the neutral zone), print: "Zero"
- If
01EXAMPLE 1
Input
value = -5Output
Logs: "Negative"Explanation: Value is less than 0.
02EXAMPLE 2
Input
value = 0Output
Logs: "Zero"Explanation: Value is neither > 0 nor < 0.
Constraints
- Use an if-else if-else structure.
- Log messages must match exactly.
Control FlowConditionalsMath
JavaScriptSystem handles I/O — write your function only
Loading...
4 Hidden
Input Arguments
value-5
Expected Output
Negative
Click RUN to test your solution