Strict Equality (===)
Strict equality (===) compares values without converting between types. Objects are equal only when both operands refer to the same object.
The number 4 and the text "4" are different values for this comparison.
See the mechanism
left: number 4right: string "4"Follow one example
The first result is false because the operand types differ. The second is true because both numbers have the same value. false and 0 remain different. Strict equality is a good default comparison; it does not validate or normalize data for you. NaN is not equal to itself with ===.
Predict, change and check
Predict: If a reading-time input supplies "4", can comparing it directly with numeric 4 succeed?
Test your explanation: Compare "4" with "4", then compare it with 4. Keep type conversion as a separate deliberate step in later lessons.
The tasks below ask you to explain that result and apply the idea to different inputs.
Apply and distinguish
Identity and type both matter
Strict equality does not coerce a numeric string to a number, and it does not recursively compare object fields. Two references to the same object compare equal; separately constructed records compare unequal. A failed equality check can therefore indicate a representation mismatch or an identity mismatch.
NaN is unequal to itself under ===, while +0 and -0 compare equal. Those are defined numeric cases, not a reason to replace every equality check with Object.is. Choose the rule required by the data and test the relevant boundaries rather than changing operators until a single example passes.
Check your understanding: State the input contract, identify the operation that changes the result, and give one boundary input that would distinguish the correct rule from the mistake described above.