== vs === Playground

Bayu’s counter: two things, three ways to compare. Watch == rewrite the slips before it compares, then guess what all three say about two boxes with the same…

Why it matters

if (input == 0) passes for empty text, '0', false and []. Bugs like these throw no error; they quietly make the logic wrong. Most style guides and the eqeqeq lint rule ask for ===, with one exception: x == null.

The key idea

== converts types first; === never does

Common mistakes

Try it in this playground