It's commonly known that {}
is shorter way to define an object like []
is for an array.
But now I am wondering why:
{} != ({})
{}
evaluates to undefined({})
evaluates to "correct" Object
Why is JavaScript behaving like this ?
For example 1
equals to (1)
, so why {}
not equals to ({})
?
{} != ({})
is a syntax error. – Kuska1
and{}
are quite different beasts. – Jeramie[] != []
is true. – Luht