# function forwarding

[JS](https://lochiwei.gitbook.io/web/js) ⟩ [value](https://lochiwei.gitbook.io/web/js/val) ⟩ [function](https://lochiwei.gitbook.io/web/js/val/func) ⟩ forwarding

{% hint style="success" %}
Passing <mark style="color:yellow;">**all**</mark> [**arguments**](https://lochiwei.gitbook.io/web/js/val/func/argument) along with the <mark style="color:yellow;">**context**</mark> to another function is called call <mark style="color:purple;">**forwarding**</mark>.

```javascript
function f() {
    // forward call to g()
    return g.apply(this, arguments);
}
```

{% endhint %}

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

* [ ] js.info ⟩[ func.apply](https://javascript.info/call-apply-decorators#func-apply) ⭐️&#x20;
  {% endtab %}

{% tab title="📘 手冊" %}

* [Function.prototype.apply()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply)
  {% endtab %}
  {% endtabs %}
