Checking Equality

EasyAcc. 91.7%
+25 XP 10

Safe Verifications

Checking forms effectively requires knowing when two data pieces match perfectly. A loose check (==) might consider text '1' equal to number 1, while a strict check (===) looks correctly at the true type values too.

The Assignment

Your goal is to compare inputs val1 and val2.

  1. Make a loose comparison (==) between val1 and val2.
  2. Make a strict comparison (===) between val1 and val2.
  3. Put both logic results into an array: [looseResult, strictResult] and return it.

01EXAMPLE 1

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

Explanation: Loose check ignores type matching.

Constraints

  • Return an array [boolean, boolean].
  • Understand why === should generally be preferred.
FundamentalsComparisonEquality
JavaScript
Loading...
5 Hidden

Input Arguments

val1"42"
val242

Expected Output

[true,false]

Click RUN to test your solution