JavaScriptBeginner#es6

What is destructuring?

Syntax that unpacks array elements or object properties into variables, with support for defaults, renaming and nesting. Widely used for function parameters and imports.

Example
const { name, city = 'NA' } = user;
const [first, ...rest] = [1,2,3];
function f({ id, opts: { deep } }) {}

Related Questions

1
JavaScriptBeginner#es6

Difference between spread and rest operators?

Open
2
JavaScriptIntermediate#objects

How do you deep clone an object?

Open
3
JavaScriptIntermediate#es6#operators

What is optional chaining and nullish coalescing?

Open