JavaScript Destructuring Guide
Destructuring extracts values from arrays or objects into distinct variables with a concise syntax. The guide walks through Array Destructuring, Object Destructuring. `const [a, b] = [1, 2]` — basic. `const [first, , third] = arr` — skip. `const [a, ...rest] = arr` — rest. Defaults: `const [a = 5] = []`. Swap: `[a, b] = [b, a]`. Function return: `const [x, y] = getCoords()`. Nested: `const [[val]] = [[1]]`. Works with any iterable. `const {name, age} = person` — basic. Rename: `const {name: userName} = person`. Defaults: `const {name = "Guest"} = {}`. Nested: `const {address: {city}} = person`. Rest: `const {id, ...rest} = obj`. Function params: `function({name, age}) {}`. Computed: `const {[key]: val} = obj`. Multiple returns: `function() { return {a, b} }`. The guide is organized into 2 sections that build on each other, each pairing a prose explanation with runnable code. Related guides: Arrays, Strings, Numbers, Math, Date.