Destructuring assignment
Destructuring assignment is language syntax that extracts components of a structured value according to a pattern and binds them to names.
Clojure: The Essential Reference
Associative destructuring binds values from key-value collections to names according to keys specified in a binding form.
- How it is used
- Binds selected map values to local names in `let` and function parameters, avoiding repeated key lookups.
- How deep it goes
- Defines key-based forms, defaults, aliasing, and nesting, then shows their translation into ordinary binding pairs.
- Examples
- Uses a map with a missing key and an explicit `nil`, plus a function parameter containing nested map and sequence bindings.
- What you can do after
- Apply it in `let` or function parameters to unpack map inputs, provide absent-key defaults, and retain the original map.
Read how Clojure: The Essential Reference explains destructuring assignment →
Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond
A JavaScript assignment form that extracts properties from an object into distinct variables, optionally renaming the bindings.
- How it is used
- Replaces repeated property and index lookups when unpacking data structures or passing their values into functions.
- How deep it goes
- Works through property names, array positions, renaming, nesting, parameter defaults, and destructurable types; defers the iterable protocol.
- Examples
- Uses coordinates, product data, swapped variables, visualization inputs, and optional car settings to demonstrate patterns.
- What you can do after
- Practice/perform nested extraction, binding renames, variable swaps, and parameter unpacking with optional defaults.
React Quickly, Second Edition
Object destructuring is a JavaScript syntax feature that extracts properties from an object into named bindings.
- How it is used
- Simplifies access to props when defining functional React components.
- How deep it goes
- Defines object extraction, compares parameter-list and body forms, and extends to rest without exploring deeper language mechanics.
- Examples
- Uses an object assignment, a menu link component, and a class-to-function image gallery conversion.
- What you can do after
- Apply it via React functional components to name props directly and collect remaining props for pass-through.
Read how React Quickly, Second Edition explains destructuring assignment →
Learn Rust in a Month of Lunches
Destructuring is Rust syntax that binds the components of a composite value to separate variables through a matching pattern.
- How it is used
- Uses matching patterns to extract selected values from tuples, structs, enums, and function arguments.
- How deep it goes
- Explains tuple matching, ignored components, ownership moves, struct renaming, omitted fields, and parameter patterns.
- Examples
- Demonstrates tuple extraction, underscore omission, renamed Person fields, omitted City fields, and destructured function parameters.
- What you can do after
- Apply it in Rust to bind composite values, ignore unwanted parts, rename fields, and destructure function inputs.
Read how Learn Rust in a Month of Lunches explains destructuring assignment →
Refactoring to Rust
Destructuring is the extraction of component values from structured values such as enum variants through pattern matching.
- How it is used
- Extracts data stored in enum variants while handling each variant with a match expression.
- How deep it goes
- Defines payload binding and variant checking through a worked FizzBuzz example, without extending beyond enum matching.
- Examples
- Uses FizzBuzzValue::NotDivisible(i32) and binds its number as num in a match arm.
- What you can do after
- Apply it via Rust match arms to retrieve enum data safely after confirming the variant.
Read how Refactoring to Rust explains destructuring assignment →
Secrets of the JavaScript Ninja, Third Edition
Destructuring syntax assigns values extracted from an iterable or other structured value to program bindings.
- How it is used
- Uses iterable destructuring to assign sequential values to bindings and split map entries into keys and values.
- How deep it goes
- Explains iterator-driven assignment and rest collection, then warns that collecting an infinite iterable will not finish.
- Examples
- Demonstrates assigning three array values and binding each key-value pair while iterating over a Map.
- What you can do after
- Apply destructuring to bind iterable values or separate map entries into keys and values.
Read how Secrets of the JavaScript Ninja, Third Edition explains destructuring assignment →
Idiomatic Rust
Destructuring is the decomposition of a compound value into bindings for selected or constituent parts through a pattern.
- How it is used
- Uses patterns in `match` expressions to access selected or constituent parts of compound values.
- How deep it goes
- Demonstrates partial and complete tuple, struct, and enum destructuring through match patterns.
- Examples
- Shows tuple element selection, struct field matching, and enum variant bindings.
- What you can do after
- Apply pattern matching to bind values from tuples, structs, and enum variants.
Also covered in
- React Hooks in Action: With Suspense and Concurrent Mode
- The Joy of JavaScript
- Kotlin in Action, 2E
- Julia as a Second Language
- Essential TypeScript 5, Third Edition
- Building User-Friendly DSLs
- Code Like a Pro in Rust
- JavaScript in DepthIn early access (MEAP)
- Vanilla WebIn early access (MEAP)
What to know first
- arrayAn array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
- objectAn object is a distinct entity represented or manipulated within a computational system, typically as a value, data structure, resource, or instance of a type.
- attributeAn attribute is a named property or piece of information associated with an entity, object, or structured data item.
- syntactic sugarSyntactic sugar is language notation that makes an existing operation or construct more concise or convenient to express without changing its computational meaning.
Related concepts
- tupleuses · A tuple is a finite, ordered collection of values grouped as a single composite value, often with elements of different types.
- objectuses · An object is a distinct entity represented or manipulated within a computational system, typically as a value, data structure, resource, or instance of a type.
- arrayuses · An array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
- pattern matchingused by · Pattern matching is the process of comparing values or input with specified patterns to identify matches, classify data, or select corresponding behavior.
Questions about destructuring assignment
What is destructuring assignment?
Destructuring assignment is language syntax that extracts components of a structured value according to a pattern and binds them to names.
Which Manning books explain destructuring assignment?
Clojure: The Essential Reference, Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond, React Quickly, Second Edition, Learn Rust in a Month of Lunches, Refactoring to Rust, Secrets of the JavaScript Ninja, Third Edition and Idiomatic Rust.
What should I know before learning destructuring assignment?
Manning books that teach destructuring assignment usually introduce array, object, attribute and syntactic sugar first.
What is destructuring assignment also called?
Destructuring assignment is also called destructuring syntax.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.






