Since the complete answer is never given and I actually understand it now, I'll provide the answer myself.
I found this in the Ecma-262 pdf:
It basically reads that [] == 0 is the same as Number([]) == 0 which is the same as 0 == 0 which is true. This does not apply to strict ===.
There is no rule to compare objects other then rule number one, which is x is the same as y. This means the same in everything, also memory address. Since they are not sharing the same memory address, rule 10 applies (return false).
The comparison x == y, where x and y are values, produces true or
false. Such a comparison is performed as follows:
If Type(x) is the same as Type(y), then
a. Return the result of performing Strict Equality Comparison x === y.
If x is null and y is undefined, return true.
- If
x is undefined and y is null, return true.
- If
Type(x) is Number and Type(y) is String, return the result of the comparison x == ToNumber(y).
- If
Type(x) is String and Type(y) is Number, return the result of the comparison ToNumber(x) == y.
- If
Type(x) is Boolean, return the result of the comparison ToNumber(x) == y.
- If
Type(y) is Boolean, return the result of the comparison x == ToNumber(y).
- If
Type(x) is either String, Number, or Symbol and Type(y) is Object, return the result of the comparison x == ToPrimitive(y).
- If
Type(x) is Object and Type(y) is either String, Number, or Symbol, return the result of the comparison ToPrimitive(x) == y.
- Return false
0is confusing me completelyconsole.log([] === 0)givesfalse