Equality in JavaScript

December 31, 2010 at 10:21 AM | Uncategorized | View Comments

After seeing Problem, Boole?, a table of comparisons in PHP, I decided to bang up a quick JavaScript version (a cell is green when column == row):

truefalse10-1"1""0""-1""""javascript"nullundefined[]{}[[]][0][1]NaN
true
false
1
0
-1
"1"
"0"
"-1"
""
"javascript"
null
undefined
[]
{}
[[]]
[0]
[1]
NaN

The source can be found over at GitHub: https://gist.github.com/761080.