Alex Rivera | Logout

JavaScript: {}==false is a SyntaxError?

Asked 2009-10-02T13:34:46.330
16

In Firefox 3.5, I type this in the Firebug console :

false=={} // => evals to false
{}==false // syntax error

What is the explanation for this ?

Edit
Report

1 Answer

0

Simply to say, {}==false are compiled by Js compiler to {};==false, so it's syntax error. you should write ({})==false and it'll return false.

answered 2012-01-05T07:51:26.800

Your Answer