---
description: a function that is an object's property.
---

# method

[JS](../..) ⟩ [value](..) ⟩ [object]() ⟩ method

{% hint style="success" %}
a [func](../func "mention") that is an object's [prop](prop "mention").
{% endhint %}

{% tabs %}
{% tab title="🔴 主題" %}
* <mark style="color:yellow;">**features of method**</mark>
  * [home-object](method/home-object "mention") - every **method** remembers its [HomeObject](https://javascript.info/class-inheritance#homeobject).
  * [as](../../iteration/generator/func/as "mention") (method)
* <mark style="color:yellow;">**method transformers**</mark>
  * [decorator](../func/kind/higher/decorator "mention")
  * [memoize](../func/kind/higher/decorator/memoize "mention") - make a method "remember" its return values.
* <mark style="color:yellow;">**other topics**</mark>
  * [polymorphism](method/polymorphism "mention") - same method name, different callers.
{% endtab %}

{% tab title="⭐️ 重點" %}
{% hint style="warning" %}
⭐️ 非常重要：

* only <mark style="color:purple;">**methods**</mark> have [<mark style="color:purple;">**`[[HomeObject]]`**</mark>](method/home-object).
* [super](../class/inheritance/super "mention") can only be used <mark style="color:yellow;">**within**</mark>**&#x20;**<mark style="color:purple;">**methods**</mark>.
{% endhint %}

{% hint style="warning" %}
&#x20;[this](../../concept/execution-context/this "mention")&#x20;

* is <mark style="color:red;">**not**</mark>**&#x20;**<mark style="color:yellow;">**fixed**</mark> in a <mark style="color:purple;">**method**</mark>.&#x20;
* <mark style="color:yellow;">**does**</mark>**&#x20;**<mark style="color:red;">**not**</mark>**&#x20;**<mark style="color:yellow;">**necessarily refer**</mark> to the [](<> "mention") containing the <mark style="color:purple;">**method**</mark>.
* is <mark style="color:yellow;">**passed**</mark> by the <mark style="color:yellow;">**function call**</mark>.  👉 [method binding](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this#method_binding).
{% endhint %}
{% endtab %}

{% tab title="📗 參考" %}
* [ ] JS.info ⟩&#x20;
  * [ ] [Object methods & "this"](https://javascript.info/object-methods)
  * [ ] [\[\[HomeObject\]\]](https://javascript.info/class-inheritance#homeobject) - every **method** remembers its [HomeObject](https://javascript.info/class-inheritance#homeobject).
{% endtab %}

{% tab title="📘 手冊" %}
* [ ] [Method](https://developer.mozilla.org/en-US/docs/Glossary/Method)
* [ ] [this](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this#method_binding) (method binding)
* [ ] [Functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions) ⟩ [Method definitions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions)
* [ ] [Expressions and operators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators) ⟩ [Object initializer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer) ⟩ [Method definitions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#method_definitions)
{% endtab %}
{% endtabs %}
