The Void Scanner

MediumAcc. 91.4%
+20 XP 8

Identifying the Void

In JavaScript, not all "falsy" values are the same. A null is different from an undefined, and both are different from a numeric 0. To catch these accurately, you must use Strict Equality (===) within your decision paths.

The Assignment

Your function receives a parameter named val.

  1. Write a precise if-else if ladder:
    • If val is strictly null, print: "Value is Null."
    • If val is strictly undefined, print: "Value is Undefined."
    • If val is strictly 0, print: "Value is Zero."
    • For any other value, print: "Value exists."

01EXAMPLE 1

Inputval = null
OutputLogs: "Value is Null."

Explanation: Strictly matches null.

02EXAMPLE 2

Inputval = 5
OutputLogs: "Value exists."

Explanation: Matches none of the special falsy cases.

Constraints

  • Use strict equality (===).
  • Log messages must match exactly including the period.
Control FlowConditionalsTypes
JavaScript
Loading...
3 Hidden

Input Arguments

valnull

Expected Output

Value is Null.

Click RUN to test your solution