What is destructuring, and what forms does it come in?
Destructuring is a syntax that pulls values out of an object or an array and binds them to names in one step. It is the inverse of building an object from named variables, and it replaces a lot of repeated property access.
There are four forms you should be able to name. Object destructuring uses curly braces and matches property names. Array destructuring uses square brackets and matches by position. Renaming assigns to a different local name using a colon. Defaults fill in a value when the property is missing, using an equals sign. Rest collects everything you did not name, using three dots.
Nesting works too. If you destructure an object whose property is itself an object, you can go deeper by nesting another pattern inside the first one, which lets you reach a nested value in a single statement without a chain of intermediate variables.
The main benefit is that destructuring separates the shape of the data from the code that uses it. When a function takes an options object, destructuring the parameter makes the accepted keys obvious to a reader and to a type checker, and it means the function body never repeats the options prefix. It also gives you a natural place to put defaults, which is usually the only reason a function signature looked complicated in the first place.