JavaScript equality table
· One min read
I recently stumbled upon the JavaScript equality table. I'm always impressed by nice ways of visualizing such concepts. And I immediately thought it would be a fun thing to build myself!
Choose between double equals and triple equals to see how that affects the equality table.
| true | false | 1 | 0 | -1 | "true" | "false" | "1" | "0" | "-1" | "" | null | undefined | Infinity | -Infinity | [] | {} | [[]] | [0] | [1] | NaN | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| true | |||||||||||||||||||||
| false | |||||||||||||||||||||
| 1 | |||||||||||||||||||||
| 0 | |||||||||||||||||||||
| -1 | |||||||||||||||||||||
| "true" | |||||||||||||||||||||
| "false" | |||||||||||||||||||||
| "1" | |||||||||||||||||||||
| "0" | |||||||||||||||||||||
| "-1" | |||||||||||||||||||||
| "" | |||||||||||||||||||||
| null | |||||||||||||||||||||
| undefined | |||||||||||||||||||||
| Infinity | |||||||||||||||||||||
| -Infinity | |||||||||||||||||||||
| [] | |||||||||||||||||||||
| {} | |||||||||||||||||||||
| [[]] | |||||||||||||||||||||
| [0] | |||||||||||||||||||||
| [1] | |||||||||||||||||||||
| NaN |
