> 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/args.md).

# destructuring arguments

🚧 under construction -> merge

[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) ⟩ arguments

{% tabs %}
{% tab title="💈範例" %}
👉 See： [object destructuring](/web/js/grammar/op/assign/destruct/obj.md) 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 values](/web/js/grammar/op/assign/destruct/nested/nested-default.md)
  {% endtab %}

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

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

{% tab title="🚧" %}

* [ ] merge  with [destructured parameter](/web/js/val/func/param/destructured.md)
  {% endtab %}
  {% endtabs %}
