DEV Community

Discussion on: What is {x:1} and why does it return 1 🤷‍♂️

Collapse
 
joas8211 profile image
Jesse Sivonen

Please correct me if I'm wrong. Parentheses turn the example labeled statement into object literal because grouping operator is an expression that cannot contain statements. Only blocks can contain statements. Statements are constructs that cannot be assigned into a variable where as expressions can.

Collapse
 
jonathanalberghini profile image
Jon Alberghini