The Essence Scanner
Medium+20 XP
Mission Briefing
The vault will only open if a true element is placed on the pedestal. Some items look real but are merely illusions (falsy). Build a scanner to detect true essence.
The Concept: Truthy vs Falsy
In JS, every value has an inherent boolean state. A value is falsy if it translates to false when evaluated. The falsy values are: false, 0, -0, 0n, "", null, undefined, and NaN. Everything else is truthy.
The Objective
Your function receives a parameter val.
- Evaluate whether
valis truthy or falsy. - If it is truthy, return the exact string "Exists".
- If it is falsy, return the exact string "Empty".
Constraints
FundamentalsLogic
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
val"Hi"
Expected Output
Exists
Click RUN to test your solution