Why is this not valid when using the new es6 destructuring syntax
var a, b, c;
{a, b, c } = {a:1, b:2, c:3};
when this is:
In your example, the first {
is ambiguous and the parser will interpret it as the beginning of a block. While {a, b, c}
is a valid block, the following assignment operator is not valid.
Wrap everything in parenthesis and it will parse correctly:
({a, b, c} = {a:1, b:2, c:3});
Example
This is similar to having an object literal by itself (for whatever reasons):
{"a": 42} // parse error
({"a": 42}) // works