Deepen your understanding of JavaScript's type system and how the language evaluates code.
Prepare for technical interviews by learning the quirks and edge cases interviewers probe.
Debug unexpected behavior in your own code by recognizing common JavaScript gotchas.
WTF JavaScript is a curated collection of surprising, counter-intuitive, and sometimes hilarious JavaScript code examples, each one accompanied by an explanation of why the language behaves that way. The problem it solves is not a technical one but an educational one: JavaScript has many quirks baked into its specification that confuse beginners and catch even experienced developers off guard. Rather than pretending these quirks don't exist, this project shines a light on them. Each entry follows a simple format: a short snippet of valid JavaScript that produces a result most people would not expect, followed by an Explanation section that walks through the relevant specification rules. Examples range from the famous floating-point imprecision (0.1 + 0.2 not equaling 0.3) to stranger behaviors like an empty array being equal to the negation of an empty array, NaN not being equal to itself, and Math.max() returning a value smaller than Math.min() when called with no arguments. The explanations cite the JavaScript specification (ECMAScript) and walk through type coercion, operator precedence, and prototype rules, core language mechanics that are easy to misunderstand. You would use this repository when you want to deepen your understanding of JavaScript's type system and evaluation rules, prepare for technical interviews that probe language internals, or simply enjoy the humor of a language that occasionally feels like it was designed to trick you. The handbook is installable as an npm package (so you can read it from the command line), translated into multiple languages, and organized with a table of contents for easy browsing. The tech stack is minimal: it is essentially a Markdown document distributed as a Node.js npm package, written in JavaScript for its examples. No runtime framework or build system is involved.
Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.