46

Array and Object Destructuring

In this Chapter

  • Learn the basics of destructuring

  • Understand how to unpack variables from arrays and objects

A lot of the improvements made to JavaScript revolve around adding missing capabilities, such as being able to access the webcam, using cool new data structures such as sets, interacting in more creative ways with the DOM, and more. Some improvements fall purely on the side of convenience. There are many highly inconvenient JavaScript tasks we regularly perform that either take too much code or require too many “gotchas” to work properly. One such task involves taking values from arrays or objects and storing them in variables. Allow me to elaborate. Let’s say that we have an array and it contains ...

Get Javascript Absolute Beginner's Guide, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.