> 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/err/type.md).

# ⛔️ TypeError

occurs when something can't be done on the subject of the statement.

[JS](/web/js.md) ⟩ [error](/web/js/err.md) ⟩ TypeError

{% hint style="success" %}
([runtime error](/web/js/err/runtime.md)) occurs when <mark style="color:yellow;">**some operation**</mark>**&#x20;**<mark style="color:red;">**can't**</mark>**&#x20;**<mark style="color:yellow;">**be performed**</mark> on the <mark style="color:yellow;">**subject**</mark> (value/object) of the statement. (that is, the <mark style="color:yellow;">**subject**</mark> of the <mark style="color:yellow;">**action**</mark> is of the "<mark style="color:red;">**wrong**</mark>" <mark style="color:yellow;">**type**</mark>, it isn't capable to do that kind of thing)
{% endhint %}

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

* ['xxx' is not a function❗️](/web/js/err/type/not-function.md)
* [assignment to constant variable❗️](/web/js/err/type/const-no-reassign.md)
* [cannot read properties of nullish❗️](/web/js/err/type/cannot-read-properties-of-nullish.md)
* [cannot convert BigInt to Number❗️](/web/js/err/type/no-bigint-to-num.md)
* [cannot convert Symbol to Number❗️](/web/js/err/type/no-sym-to-num.md)
  {% endtab %}

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

* :no\_entry:[const](/web/js/variable/declare/const.md) - can't be reassigned, redeclared:exclamation:
* :no\_entry: <mark style="color:red;">**TypeError**</mark> <mark style="color:yellow;">**thrown**</mark> <mark style="color:red;">**if**</mark> "[**optional chaining**](broken://pages/GIXz6uvi1pdGnUWpHWXs)" **not used** to guard againt [<mark style="color:blue;">**nullish**</mark>](/web/js/val/prim/nullish.md):exclamation:
* :no\_entry:[object -> primitive conversion](/web/js/val/obj/convert/obj-to-prim.md) may result in <mark style="color:red;">**TypeError**</mark>:exclamation:
  {% endtab %}

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

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

{% tab title="⭐️ 重點" %}
{% hint style="warning" %} <mark style="color:yellow;">**calling**</mark> a [var](/web/js/variable/declare/var.md) (as function) <mark style="color:red;">**before initialization**</mark> will cause a <mark style="color:red;">**TypeError**</mark> at [runtime](/web/js/compile/runtime.md):exclamation: 👉 [var hoisting](/web/js/scope/hoist/variable/var.md)
{% endhint %}
{% endtab %}
{% endtabs %}
