1. Loose equality coerces
== converts both sides before comparing, so 0 and "" both become 0 and match.
0 == "" // true — both coerce to falsyTyporithm · easy
Step 1 of 8 · intro card
JS Gotchas
== coerces both operands before comparing, producing surprises like 0 == "". === compares type and value with no conversion. null == undefined is true, and NaN is never equal to itself.
Loose equality (==) converts the operands to a common type before comparing, so 0 == "" and 0 == false are both true even though the values look different.
Strict equality (===) compares type and value directly with no conversion, so 0 === "" is false — that is why teams default to ===.
Two special cases bite everyone: null == undefined is true (they are loosely equal only to each other), and NaN === NaN is false because NaN is never equal to itself.
== coerces before comparing; === does not.
0 == "" is true but 0 === "" is false.
null == undefined is true; NaN === NaN is false.
0 == "" // true — both coerce to falsy
0 === "" // false — different types
null == undefined // true — loose equality
NaN === NaN // false — NaN never equals itselfConnect each part of the code to the concept before you type.
== converts both sides before comparing, so 0 and "" both become 0 and match.
0 == "" // true — both coerce to falsy=== compares type and value with no conversion, so a number is never equal to a string.
0 === "" // false — different typesLoose equality treats null and undefined as equal to each other (and to nothing else).
null == undefined // true — loose equalityNaN is the only value not equal to itself; use Number.isNaN to test for it.
NaN === NaN // false — NaN never equals itselfRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.