https://jsfiddle.net/5Yzs6/17/
Did you know undefined is equal to undefined, but not <= undefined or >= undefined?
Or that two instances of the same object/array are not equal (e.g. [-1] != [-1]), but are both <= and >= each other?
Or that /.*/ is non-comparable (only != is true) to all numbers, but greater than [-0.5] and "-0.5", and less than [0] and "0"?
By that definition, Brainf*ck[1] also makes sense.
NaN === Nan // => false
[] === [] // => false
{} === {} // => false
[1] === [1] // => false
[0] === [0] // => false
I guess i never see the gains in the triple vs double equal sign wars.The NaN example comes directly from IEEE754
The others are based on the fact that the two sides are not referring to the same object. C "equivalents" of your examples:
int x[0], y[0]; x == y; // false
typedef struct {} empty_t; empty_t *x, *y; x == y; // false
int x[] = { 1 }, y[] = { 1 }; x == y; // false
int x[] = { 0 }, y[] = { 0 }; x == y; // falseOne array or object does not equal another, different one.
There are definitely gains - I strongly suggest following the 'moral' of the story.
At least the === paradigm is fairly consistent and mostly rational.
"0" == 0 && "0" !== 0