Destructuring

Introduction
Software engineering and Development requires working with arrays and objects every day. One thing you'll want to do in this daily work is extract values from these data structures. Before ES2015, the code for this was quite tedious to implement, so a new feature was introduced called destructuring.
In this subunit, you'll learn how to use destructuring to easily unpack values from a variety of objects, functions, arrays, and nested data structures. You'll see how destructuring can be used to swap values in arrays, and at the end of the subunit, you'll have a few exercises to get some hands-on practice.
Goals
Understand what destructuring is
Use object destructuring to write less code
Use array destructuring to swap values and extract nested values
Object Destructuring
JavaScript programmers take things out of objects all the time.
Here's how you used to have to extract values into variables.
That’s A Lot of Typing
So they came up with some syntactic sugar.
Destructuring and Spread
Renaming with Destructuring
Defaults with Destructuring
Destructuring Nested Objects
Destructuring Functions
We can use destructuring to extract key/value pairs from an object into variables.
We're going to assume the function is passed an object with a key of name and age
But what happens if the object does not contain a key of name or age?
We can use default parameters!
You Can Apply The Same Concept To Arrays!
Fancy 1 -Line Array Value Swap