The Abstract Equality Algorithm: What == Actually Does in JavaScript

Not a list of quirks to memorize, a walk through the specification steps that produce them. Most explanations of JavaScript’s == operator work backwards. They start from the famous surprises, [] == false, "" == 0, null == undefined, and hand you a rule of thumb to memorize each one. That approach treats the language as a pile of folklore. …