DEV Community

Discussion on: Destructuring JavaScript objects like a pro

Collapse
 
c24w profile image
Chris Watson

I found that slightly counterintuitive to start with, too, when you're used to name = value. The easiest way I find to remember the order is { from: to } = obj. Also, it wouldn't make much sense to use { to: from } = obj because you're no longer putting the from in the same position as the key is in the object.