JavaScript lets us easily create “bags of data” using objects and arrays, permitting us the ability to fluidly wrap data and ship it around in our code. However, the syntax afforded to us to “reach” into these data structures tends to be verbose, imperative, and error-prone. In ES6 and ES9, JavaScript adopts yet another functional construct in the form of the destructuring syntax to improve our experience with unwrapping data, bringing it to parity with how we wrap data in the first place.
In this chapter we will see how the new destructuring syntax for both objects and ...