# destructuring arguments

[JS](https://lochiwei.gitbook.io/web/js) ⟩ [operator](https://lochiwei.gitbook.io/web/js/grammar/op) ⟩ [assignment](https://lochiwei.gitbook.io/web/js/grammar/op/assign) ⟩ [destructuring](https://lochiwei.gitbook.io/web/js/grammar/op/assign/destruct) ⟩ arguments

{% tabs %}
{% tab title="💈範例" %}
👉 See： [obj](https://lochiwei.gitbook.io/web/js/grammar/op/assign/destruct/obj "mention") for more info.

```javascript
const {log} = console;

// function parameter by object destructuring
function f ({
  hi = 2,         // default param
  ...options      // other params as an object ⭐️
}={}) {

  log(options);   
  return hi;      
}

// test run
f({x: 1, y: 2, hi: 3});      // 3
// options = { x: 1, y: 2 }
```

{% endtab %}

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

* [nested-default](https://lochiwei.gitbook.io/web/js/grammar/op/assign/destruct/nested/nested-default "mention")
  {% endtab %}

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

* [x] JS.info ⟩ [smart function parameters](https://javascript.info/destructuring-assignment#smart-function-parameters)
* [ ] [javascript-the-definitive-guide](https://lochiwei.gitbook.io/web/master/ref/javascript-the-definitive-guide "mention") ⟩&#x20;
  * [ ] 3.10.3 Destructuring Assignment
  * [ ] 8.3.5 Destructuring Function Arguments into Parameters
    {% endtab %}

{% tab title="🚧" %}

* [ ] merge  with [destructured](https://lochiwei.gitbook.io/web/js/val/func/param/destructured "mention")
  {% endtab %}
  {% endtabs %}


---

# Agent Instructions: 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/args.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.
