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.

  1. Determine if both values share the same logical truthiness.
  2. Return true if both are truthy OR both are falsy.
  3. Return false if one is truthy and the other is falsy.

01EXAMPLE 1

Inputa = "Hi", b = []
Outputtrue

Explanation: Strings and Arrays are both truthy.

Constraints

  • Use the logical NOT (!) operator twice to find truthiness.
  • Compare the results strictly.
LogicTruthinessMastery
JavaScript
Loading...
3 Hidden

Input Arguments

a"Hi"
b1

Expected Output

true

Click RUN to test your solution