Boolean Equality
HardAcc. 70.8%
+45 XP 12
Truthiness Matching
Two values from completely different universes (like a string and an object) can still be "equal" in terms of their Truthiness.
For example, "Hello" and 42 are both truthy. null and 0 are both falsy.
The Assignment
Your function receives parameters a and b.
- Determine if both values share the same logical truthiness.
- Return
trueif both are truthy OR both are falsy. - Return
falseif one is truthy and the other is falsy.
01EXAMPLE 1
Input
a = "Hi", b = []Output
trueExplanation: Strings and Arrays are both truthy.
Constraints
- Use the logical NOT (!) operator twice to find truthiness.
- Compare the results strictly.
LogicTruthinessMastery
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
a"Hi"
b1
Expected Output
true
Click RUN to test your solution