|
1 |
| -# Destructuring-in-Javascript |
| 1 | +# Destructuring-in-Javascript |
| 2 | + |
| 3 | +A. DESTRUCTURING ASSIGNMENT |
| 4 | + |
| 5 | +The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables. |
| 6 | + |
| 7 | +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. |
| 8 | + |
| 9 | +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. |
| 10 | + |
| 11 | +Destructuring Variable / Assignment are including: |
| 12 | + |
| 13 | +1. Destructuring Array - by using [] |
| 14 | + |
| 15 | +2. Skipping Items |
| 16 | + |
| 17 | +3. Swap Items |
| 18 | + |
| 19 | +4. Return Value in a Function |
| 20 | + |
| 21 | +5. Rest Parameter (...something) |
| 22 | + |
| 23 | +6. Destructuring Object - by using {} |
| 24 | + |
| 25 | +7. Assignment without Object Declaration |
| 26 | + |
| 27 | +8. Assignment to New Variable |
| 28 | + |
| 29 | +9. To Give Default Value |
| 30 | + |
| 31 | +10. To Give Default Value and Assignment to New Variable |
| 32 | + |
| 33 | +11. Rest Parameter in Object |
| 34 | + |
| 35 | +12. Retrieve from An Object then Pass To A Function |
| 36 | + Retrieves a field in an object, after it is passed as a parameter to a function. |
| 37 | + |
| 38 | +B. DESTRUCTURING FUNCTION |
| 39 | + |
| 40 | +1. Destructuring function return value |
| 41 | + 1.1 Destructuring Array |
| 42 | + 1.2 Destructuring Object |
| 43 | + |
| 44 | +2. Destructuring function arguments |
| 45 | + |
| 46 | + |
| 47 | + |
0 commit comments