Destructuring
The destructuring assignment is a cool feature that came along with ES6.
Destructuring assignment that allows you to Destructure or unpack an array into individual variables.
Set of values is unpack then assigned to individual variables.
Destructuring is a JavaScript
expression that makes it possible to unpack values from arrays, or properties from objects,
into distinct variables. That is, we can extract data from arrays and objects and assign them to variables.
They are two types Destructuring :
Destructuring
Array Destructuring
Object Destructuring
Why do we use Destructuring in JavaScript?
The object destructuring is a useful JavaScript feature to extract properties from objects and bind them to variables. What's better, object destructuring can extract multiple properties in one
statement, can access properties from nested objects, and can set a default value if the property doesn't exist