In the following code snippet:
// Error code:
(y,...x) => {...x,y};
// output = "SyntaxError: Unexpected token ..."
// Expected result:
(y,...x) => ({...x,y});
I don't quite understand why the "()" are needed to surround the object literal. I suspect it is due to the spread operator, as when i remove it I no longer need the parentheses. Surely i'm missing something obvious here?