In mathmetics a relation is said to be
symmetric
if it holds true that if a is related to b, then b must also be related to a.
For the equals operator this means that if `a == b`

evaluates to
`true`

, than `b == a`

must also evaluate to `true`

.
In most languages equals is expected to be symmetric, transitive and reflexive:

- reflexive
- Given any object
`a`

, for equals to be*reflexive*, it must hold true that`a == a`

. - symmetric
- Given any objects
`a`

and`b`

and asserting that`a == b`

, for equals to be*symmetric*it must also hold true that`b == a`

. - transitive
- Given any objects
`a`

,`b`

and`c`

and asserting that`a == b && b == c`

, for equals to be*transitive*it must also hold true that`c == a`

.

I am limiting the scope above to objects to explicitly exclude things
like `NaN`

(Not a Number), `null`

and `undefined`

,
because these are somewhat 'magical' values.

Is the equals operator symmetric in your browser?

Test now!

The test is performed by comparing the values of `this`

and `window`

in a function that was assigned to the global (`window`

) object from within
an anonymous function. For some reason in Internet Explorer 8 (maybe other versions as
well), in that context `this == window`

yields `false`

(wrong),
even though `window == this`

yields `true`

(correct) and it can
be clearly seen in the debugger that `this`

and `window`

are in
fact the same object.