=== compares value and type with no conversion, while == converts both sides to a common type and then compares. That conversion is called type coercion.
With loose equality, 5 == "5" is true because the string becomes a number first. With strict equality, 5 === "5" is false because a number and a string are different types. A special case is null == undefined, which is true, while null === undefined is false.
The coercion rules are hard to predict, so use === by default. The one common exception is value == null, which checks for null and undefined together.
5 == "5"; // true (coercion)
5 === "5"; // false (different types)
null == undefined; // true
null === undefined; // false
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
The diagram below the answer is the concept . Jump to it ↓