-
-
Save wavded/252771 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
evaluates as a block — "{" and "}" — containing one labeled statement — `a:"a"`. | |
labeled statement, in its turn, evaluates to "a". | |
*/ | |
{a:"a"} | |
/* | |
evaluates as an expression, where "(" and ")" are grouping operator and "{" and "}" constitute an object literal. | |
evaluates to this object value. | |
*/ | |
({a:"a"}) | |
/* | |
syntax error, `{a:"a",b:"b"}` is evaluated as a statement and statement can not have such syntax. | |
enforcing expression context — `({a:"a", b:"b"})` — fixes this "problem". | |
*/ | |
{a:"a",b:"b"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment