> 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/val/func/vs-arg.md).

# parameter vs. argument

[JS](/web/js.md) ⟩ [object](/web/js/val/obj.md) ⟩ [function](/web/js/val/func.md) ⟩ [parameter](/web/js/val/func/param.md) ⟩ argument vs. parameter

{% hint style="success" %}

* [parameter](/web/js/val/func/param.md)(s)&#x20;
  * live in <mark style="color:yellow;">**function's definition**</mark> ([compile-time](/web/js/compile/compile-time.md))
  * <mark style="color:yellow;">**named**</mark> [variable](/web/js/variable.md) <mark style="color:yellow;">**declared**</mark> in the [function](/web/js/val/func.md).
* [argument](/web/js/val/func/argument.md)(s)&#x20;
  * live in <mark style="color:yellow;">**call sites**</mark> ( [runtime](/web/js/compile/runtime.md), may be <mark style="color:red;">**different**</mark> on each call)
  * a [value](/web/js/val.md) for the <mark style="color:yellow;">**corresponding parameter**</mark>.

```javascript
// ⭐️ function's definition (compile-time)
function foo( param1, param2, ... ) { ... }
//           ╰─── parameters ────╯

// ⭐️ values passed into function when called (run-time)
foo( 1, 'hello', false );
//  ╰─── arguments ───╯
```

{% endhint %}

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

* [parameter](/web/js/val/func/param.md)
* [argument](/web/js/val/func/argument.md)
  {% endtab %}

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

* [x] [Argument](https://developer.mozilla.org/en-US/docs/Glossary/Argument)
* [x] [Parameter](https://developer.mozilla.org/en-US/docs/Glossary/Parameter)
* [ ] [the "arguments" object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments) - an [array-like](/web/js/val/builtin/arr/array-like.md).
  {% endtab %}
  {% endtabs %}
