Object literals behaves weird in the console

In the JavaScript console (I'm using Chrome), the expression {} evaluates to undefined. If I execute var a = {}, the expression a evaluates to Object {}. Why doesn't the expression {} evaluates to Object {}(in the console)?

Further more, {a: 4} seems to evaluate to 4, and the expression {a: 4, b: 5} is apparently incorrect syntax.



is seen as a block not an object

A block statement is used to group zero or more statements. The block is delimited by a pair of curly brackets.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.