> 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/statement/expr/invoke.md).

# invocation expression：f()

\`f(args)\` syntax.

[JS](/web/js.md) ⟩ [statement](/web/js/grammar/statement.md) ⟩ [expression](/web/js/grammar/statement/expr.md) ⟩ invocation

{% hint style="success" %}
([expression](/web/js/grammar/statement/expr.md)) <mark style="color:yellow;">**use**</mark> <mark style="color:blue;">**`f(args)`**</mark> syntax to <mark style="color:yellow;">**call**</mark> a [function](/web/js/val/func.md)/[method](/web/js/val/obj/method.md).

```javascript
f ( args )    // f: expression, args: argument list

f(0)                         // calls a function
Math.max(x, y, z)            // calls a method
```

{% endhint %}

{% tabs %}
{% tab title="🗺️ 圖表" %} <img src="https://2527454625-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfvEFZnSBhKT6fJmus0%2Fuploads%2Fh1eahK8QybyUP3ZvNGAb%2Finvocation.expression.svg?alt=media&amp;token=fe332b15-6cc3-4993-9c9c-d7b329067d3e" alt="evaluating an invocation expression" class="gitbook-drawing">
{% endtab %}

{% tab title="🔴 主題" %}

* [method invocation](/web/js/grammar/statement/expr/invoke/method-invocation.md)
* [optional invocation ?.()](/web/js/val/obj/prop/access/optional-invocation-..md)
  {% endtab %}

{% tab title="⭐️ 重點" %}
{% hint style="info" %}
If that <mark style="color:blue;">`funcExpr`</mark> is a [property access expression](/web/js/val/obj/prop/access/property-access-expression.md), then the invocation is known as a [method invocation](/web/js/grammar/statement/expr/invoke/method-invocation.md).
{% endhint %}

{% hint style="info" %}
[**property access**](/web/js/val/obj/prop/access/property-access-expression.md) and [**invocation**](/web/js/grammar/statement/expr/invoke.md) expressions have <mark style="color:red;">**higher**</mark>**&#x20;**<mark style="color:yellow;">**precedence**</mark> <mark style="color:yellow;">**than**</mark> <mark style="color:red;">**any**</mark> of the [**operators**](/web/js/grammar/op/table-of-operators.md).
{% endhint %}
{% endtab %}

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

* :information\_source:[parentheses ()](/web/js/grammar/token/punctuator/parentheses.md) punctuators are used in this syntax.
  {% endtab %}

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

* [ ] [JavaScript: The Definitive Guide](/web/master/ref/javascript-the-definitive-guide.md) ⟩&#x20;
  * [ ] 4.5 Invocation Expressions
  * [ ] Ch. 8 Functions
    {% endtab %}

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

* [ ] [Expressions and operators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators) ⟩&#x20;
  {% endtab %}
  {% endtabs %}
