Strictly Nullish
MediumAcc. 75.3%
+40 XP 12
The Nullish Perimeter
A common bug in JavaScript is treating 0 or "" as "missing data" because they are falsy. We need a logic that captures only null and undefined.
The Assignment
Your function receives a parameter named val.
- Return
trueif the value is strictlynullor strictlyundefined. - Return
falsefor any other value, including other falsy values like0,false, or"".
01EXAMPLE 1
Input
val = 0Output
falseExplanation: 0 is falsy, but not nullish.
Constraints
- Return a boolean.
- Do not be fooled by other falsy values.
LogicTypesMastery
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
val0
Expected Output
false
Click RUN to test your solution