DEV Community

Discussion on: Advanced techniques in destructuring (How to destructure arrays and objects - Part 3)

Collapse
 
x8er profile image
Maxim

We using () because variables were declared before use?

Collapse
 
26th_edmund profile image
Edmund 🚀

Not really, we use the brackets because a pair of {} standing alone is seen as a an expression, a code block, and code blocks do not appear on the Left side of an assignment, so we have to wrap it in () to convert to a statement. If it were in arrays it would be fine to do it without the parentheses.