I were trying to play around the equal to ==
operator in Javascript, and I got the following results:
0 == "0" // true
and also
0 == [0] // true
HOWEVER:
"0" == [] // false
Honestly, this is kind of confusing for me since I have no Javascript-background.
Also, I noticed that:
"0" == [0] // true
and that is also applicable for other values:
1 == [1] // true
1 == "1" // true
"1" == [1] // true
101 == "101" // true
101 == [101] // true
"101" == [101] // true
So it seems to be about comparing 0
with an empty array []
.
What is logic behind it?