JavaScript EqualityWhy == and === differ, and the coercion table that explains the surprises.Computing=== compares type and value. == converts typesfirst, using rules almost nobody remembers.'' == 0 → true · '' === 0 → false0 == '0'trueString converted to number.null == undefinedtrueThe one genuinely useful case.NaN === NaNfalseUse Number.isNaN() instead.THE COMMON MISTAKEif (x == false) to check for falsinessif (!x)[] == false is true, but [] is truthy. The coercion rules and the truthiness rulesdisagree.Falsy values, all of them: false, 0, -0, 0n, '', null, undefined, NaN.Everything else is truthy, including [] and {}.JavaScript Equalitylearnposters.com
JavaScript Equality — printable computing wall chart from LearnPosters. Free vector PDF, US Letter and A4.

What’s on the JavaScript Equality poster

The rule, 3 worked examples, and the mistake everyone makes.

Falsy values, all of them: false, 0, -0, 0n, '', null, undefined, NaN. Everything else is truthy, including [] and {}.

Questions about the JavaScript Equality poster

What’s on the JavaScript Equality poster?
The rule, 3 worked examples, and the mistake everyone makes. === compares type and value. == converts types first, using rules almost nobody remem…; '' == 0 → true · '' === 0 → false; 0 == '0' = true; null == undefined = true; NaN === NaN = false; Common mistake: if (x == false) to check for falsiness → if (!x). Falsy values, all of them: false, 0, -0, 0n, '', null, undefined, NaN. Everything else is truthy, including [] and {}.
Who is the JavaScript Equality poster for?
JavaScript Equality belongs to the Computing section rather than to a school year, because computing is not something one grade owns. Anyone learning languages can pin it up — a beginner, a student mid-course, or someone revising years later.
When should you use the JavaScript Equality poster?
Use === always. The only defensible use of == is `x == null` to catch both null and undefined. A wall chart earns its place by being glanceable from where the work is happening, so JavaScript Equality belongs on the wall where that computing work actually happens, within glancing distance, rather than filed away.
What other posters go with JavaScript Equality?
REST API Design, Bash Scripting and Error Handling sit alongside JavaScript Equality in the Computing section. Printed together they make a wall rather than a single sheet, which is how a reference set actually gets used.REST API DesignBash ScriptingError Handling
Is the JavaScript Equality poster free to download and print?
Yes. JavaScript Equality downloads as a free PDF with no account, no email and no watermark, like everything else in the Computing section. Print as many copies as you like for a home, a classroom, a library or a tutoring group; reselling the file is the only thing the licence rules out.Read the licence
What size does the JavaScript Equality poster print at?
JavaScript Equality is a vector PDF laid out for US Letter, and prints on A4 with Fit to page — the same file, no separate download. Because every mark on it is drawn rather than photographed, it stays sharp enlarged to A3, A2 or A1 at a copy shop. Colour carries emphasis only, so a greyscale print of JavaScript Equality loses nothing.Printing guide

Related posters

Charts that sit alongside JavaScript Equality on the same wall.

Browse every Computing poster, or start from the full catalogue.