# constructor

[JS](../..) ⟩ [value](..) ⟩ [function]() ⟩ constructor

{% hint style="success" %}
a [](<> "mention") that supports the [\[\[Construct\]\]](https://tc39.es/ecma262/#table-additional-essential-internal-methods-of-function-objects) [**internal method**](../obj/prop/internal), that is, a [**constructable**](../obj/create/new/callable-vs.-constructable) function.
{% endhint %}

{% tabs %}
{% tab title="⭐️ 重點" %}
{% hint style="success" %}
<mark style="color:yellow;">**function vs.**</mark>**&#x20;**<mark style="color:purple;">**constructor**</mark>

* [](<> "mention")：
  * [obj](../obj "mention") that supports the [\[\[Call\]\]](https://tc39.es/ecma262/#table-additional-essential-internal-methods-of-function-objects) internal method.&#x20;
* <mark style="color:purple;">**constructor**</mark>：&#x20;
  * object that supports the [\[\[Construct\]\]](https://tc39.es/ecma262/#table-additional-essential-internal-methods-of-function-objects) internal method.&#x20;
  * every <mark style="color:purple;">**constructor**</mark> must support [\[\[Call\]\]](https://tc39.es/ecma262/#table-additional-essential-internal-methods-of-function-objects) (that is, every <mark style="color:purple;">**constructor**</mark> is a <mark style="color:yellow;">**function**</mark>)

👉 ES2023 ⟩ [Additional Essential Internal Methods of Function Objects](https://tc39.es/ecma262/#table-additional-essential-internal-methods-of-function-objects)
{% endhint %}

{% hint style="warning" %}
👉 <mark style="color:orange;">**compare**</mark>：

* the [constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/constructor) [method](../obj/method "mention") of a [class](../class "mention").
* the [constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor) [prop](../obj/prop "mention") present on all [obj](../obj "mention")s.
{% endhint %}
{% endtab %}

{% tab title="👥 相關" %}
* a <mark style="color:purple;">**constructor**</mark> is a [](<> "mention").
* [callable-vs.-constructable](../obj/create/new/callable-vs.-constructable "mention").
{% endtab %}

{% tab title="📘 手冊" %}
* ES2023 ⟩ [Additional Essential Internal Methods of Function Objects](https://tc39.es/ecma262/#table-additional-essential-internal-methods-of-function-objects)
* [Object.prototype.constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor)
{% endtab %}

{% tab title="❓" %}
{% hint style="warning" %}
what a constructor actually is in plain JS ❓

(what does the part "supports the \[\[Construct]] internal method" really mean?)
{% endhint %}
{% endtab %}
{% endtabs %}
