DEV Community

Discussion on: 4 Ways to Level-Up Your JS Destructuring and Spread Syntax

scottodea profile image
Scott O'Dea Author • Edited on

Hey Bernd. I think you're confusing array style destructuring with object style destructuring. The order in which you destruct properties does not matter when using '{}' style destructuring.
Ex. const {a, b, c} = {c: 'foo', a: 'bar', b: 'baz'}
However, when destructuring using array syntax the order definitely matters as the properties pulled are ordered by index.
ex. const [firstElement, secondElement] = ['foo', 'bar']