DEV Community

Discussion on: Back to Basics - Simple Destructuring in JavaScript

Collapse
 
fernandomaia profile image
Fernando Maia

Really nice! I'm just learning JavaScript and this was awesome! Would you mind explaining why did you need to put curly braces on the second example, like below? Thanks!

let { europe } = hometowns;
Collapse
 
dytra profile image
dytra

Yes you need to because you’re destructuring an object

Collapse
 
fernandomaia profile image
Fernando Maia

Oh, that makes total sense haha. Thanks a lot for your answer!