Skip to content
JavaScript·Beginner·Coding·1 min read

What is the core difference between == and ===?

Short interview answer

=== compares value and type with no conversion, so operands of different types are simply unequal. == first coerces both operands to a common type using the abstract equality algorithm's defined rules, then compares them.

Example

JavaScript
1 === '1';   // false — different types, no conversion1 == '1';    // true  — '1' coerced to number 10 == false;  // true  — both coerce to 0null == undefined; // true (special-cased)

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to Equality and type coercion

Related questions