> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/web/js/grammar/op/assign/destruct/nested.md).

# nested destructuring

[JS](/web/js.md) ⟩ [operator](/web/js/grammar/op.md) ⟩ [assignment](/web/js/grammar/op/assign.md) ⟩ [destructuring](/web/js/grammar/op/assign/destruct.md) ⟩ nested

{% tabs %}
{% tab title="💾 程式" %}
💾 程式：[replit](https://replit.com/@pegasusroe/JS-nested-destructuring#index.js)

```javascript
let opts = {
    size : {width: 100, height: 200},    // object in object
    items: ["Cake", "Donut"],            // array in object
    extra: true
};

// ⭐ nested destructuring
let {
  size : {width, height},
  items: [a, b],
  title = "Menu"                         // default value
} = opts;
// width=100, height=200, a="Cake", b="Donut", title="Menu"
```

{% endtab %}

{% tab title="📗 參考" %}

* [x] JS.info ⟩ [nested destructuring](https://javascript.info/destructuring-assignment#nested-destructuring)
* [ ] Ronald Chen ⟩ [Destructuring Nested Objects](https://medium.com/@pyrolistical/destructuring-nested-objects-9dabdd01a3b8)
* [ ] Jay Cruz ⟩ [How to Destructure Nested JavaScript Objects](https://dev.to/coderjay06/how-to-destructure-nested-javascript-objects-1dcl)
  {% endtab %}

{% tab title="👥 相關" %}

* [destructuring array](/web/js/grammar/op/assign/destruct/arr.md)
* [object destructuring](/web/js/grammar/op/assign/destruct/obj.md)
  {% endtab %}

{% tab title="⬇️ 應用" %}

* [app.makeTable()](/web/appendix/gas/app/member/maketable.md)
  {% endtab %}

{% tab title="🗣 討論" %}

* [ES6 deep nested object destructuring](https://stackoverflow.com/questions/40622385/es6-deep-nested-object-destructuring)
  {% endtab %}
  {% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lochiwei.gitbook.io/web/js/grammar/op/assign/destruct/nested.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
