Equality Comparisons

EasyAcc. 91.7%
+25 XP 10

Data Integrity

Verification systems must decide when two pieces of data are truly equal. Loose Equality (==) allows for type conversion, while Strict Equality (===) checks both value and type.

  1. Perform a loose comparison between val1 and val2.
  2. Perform a strict comparison between val1 and val2.
  3. Return both results in an array: [looseResult, strictResult].

01EXAMPLE 1

Inputval1 = "42", val2 = 42
Output[true, false]

Explanation: Coercion allows loose equality to pass.

Constraints

  • Return an array [boolean, boolean].
  • Prefer strict equality for all real-world code.
FundamentalsComparisonEquality
JavaScript
Loading...
9 Hidden

Input Arguments

val1"42"
val242

Expected Output

[true,false]

Click RUN to test your solution