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.
- Make a loose comparison (
==) betweenval1andval2. - Make a strict comparison (
===) betweenval1andval2. - Put both logic results into an array:
[looseResult, strictResult]and return it.
01EXAMPLE 1
Input
val1 = "42", val2 = 42Output
[true, false]Explanation: Loose check ignores type matching.
Constraints
- Return an array [boolean, boolean].
- Understand why === should generally be preferred.
FundamentalsComparisonEquality
JavaScriptSystem handles I/O — write your function only
Loading...
5 Hidden
Input Arguments
val1"42"
val242
Expected Output
[true,false]
Click RUN to test your solution