Destructuring assignment syntax lets you extract values from arrays or properties from objects into distinct variables.
Basic object destructuring: const { name, age } = person. You can rename: const { name: userName } = person. Set defaults: const { role = "user" } = person. Nest deeply: const { address: { city } } = person.
Array destructuring works by position: const [first, second] = items. Skip elements: const [first, , third] = items. Use rest: const [head, ...tail] = items. Swap variables: [a, b] = [b, a].
Function parameters benefit enormously: function createUser({ name, email, role = "viewer" }) {}.
Advanced patterns include destructuring in for...of loops, combining with default values for API responses, and using with async functions. Be cautious with deep destructuring — it can throw if an intermediate property is undefined.