---
description: 🚧 under construction
---

# rest parameters

[JS](../../..) ⟩ [object](../../obj) ⟩ [function](..) ⟩ [parameter]() ⟩ rest parameters

{% hint style="success" %}
🚧
{% endhint %}

{% tabs %}
{% tab title="🔴 主題" %}
* [rest](rest-parameters/rest "mention")
{% endtab %}

{% tab title="💈範例" %}
💾 程式：[replit](https://replit.com/join/kvserhbykg-lochiwei)

```javascript
const { log } = console;

function f({        // parameter destructuring
    hi = 0,         // default parameter
    
    ...opts         // rest params as an object ⭐️
    
} = {})             // default parameter
{
    log(hi);
    log(opts);
}

// test run
f();                        // 0, {}
f({ x: 1, y: 2, hi: 3 });   // 3, { x: 1, y: 2 }
```
{% endtab %}

{% tab title="👥 相關" %}
* [destruct](../../../grammar/op/assign/destruct "mention")
* [rest-operator-...](../../../grammar/op/rest-operator-... "mention")
{% endtab %}

{% tab title="📘 手冊" %}
* [Rest parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters)
{% endtab %}
{% endtabs %}
