Destructuring in Javascript

A. DESTRUCTURING ASSIGNMENT

The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.

Destructuring means to break down a complex structure into simpler parts. With the syntax of destructuring, you can extract smaller fragments from objects and arrays. It can be used for assignments and declaration of a variable.

Destructuring saves you time and lines of code. One line accomplishes what 2 or 10 lines of code do. Specifically for React destructuring helps you keep your code DRY (Don't Repeat Yourself).

Destructuring Variable / Assignment are including:

1. Destructuring Array - by using []

2. Skipping Items

3. Swap Items

4. Return Value in a Function

5. Rest Parameter in Array (...something)

6. Destructuring Object - by using {}

Object and nested object destructuring

7. Assignment without Object Declaration

8. Assignment to New Variable

9. To Give Default Value

10. To Give Default Value and Assignment to New Variable

11. Rest Parameter in Object

12. Extract Fields of Function in Object Destructuring

Object destructuring by using function. Retrieves a field in an object, after it is passed as a parameter to a function. Including .map method to destructure an object.

B. DESTRUCTURING FUNCTION

1. Destructuring function return value

1.1 Destructuring Array
1.2 Destructuring Object

2. Destructuring function arguments