# 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 %}
