> 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/builtin/arr/element/index.md).

# element index

[JS](/web/js.md) ⟩ [object](/web/js/val/obj.md) ⟩ [built-in](/web/js/val/builtin.md) ⟩ [Array](/web/js/val/builtin/arr.md) ⟩ [element](/web/js/val/builtin/arr/element.md) ⟩ index

{% hint style="success" %} <mark style="color:yellow;">**(**</mark>[String](/web/js/val/prim/str.md)<mark style="color:yellow;">**)**</mark>&#x20;

<mark style="color:yellow;">**array elements**</mark> are <mark style="color:yellow;">**numbered**</mark>, <mark style="color:yellow;">**starting from**</mark>**&#x20;**<mark style="color:blue;">**0**</mark>, this number is called the element's <mark style="color:purple;">**index**</mark>, an <mark style="color:purple;">**index**</mark> <mark style="color:red;">**must**</mark>**&#x20;**<mark style="color:yellow;">**be**</mark> <mark style="color:blue;">**non-negtive**</mark>**&#x20;integers**:exclamation:
{% endhint %}

{% tabs %}
{% tab title="🧨 雷區" %}
{% hint style="warning" %}
[element index is string❗️](/web/js/val/builtin/arr/element/index/element-index-is-string.md)
{% endhint %}
{% endtab %}

{% tab title="⭐️ 重點" %}
{% hint style="info" %}
JavaScript arrays are <mark style="color:yellow;">**zero-based**</mark> and use <mark style="color:yellow;">**32-bit**</mark> indexes: the index of the first element is <mark style="color:yellow;">**0**</mark>, and the <mark style="color:red;">**highest possible index**</mark> is <mark style="color:blue;">**4294967294**</mark> (<mark style="color:yellow;">**2³²−2**</mark>).
{% endhint %}

{% hint style="warning" %}
JavaScript arrays <mark style="color:yellow;">**have**</mark> <mark style="color:red;">**no notion**</mark> of an “<mark style="color:yellow;">**out of bounds**</mark>” error. When you try to query a <mark style="color:red;">**nonexistent**</mark>**&#x20;**<mark style="color:yellow;">**property**</mark> of any object, you don’t get an error; you simply get [**undefined**](/web/js/val/prim/undefined.md).
{% endhint %}
{% endtab %}

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

* :white\_check\_mark: <mark style="color:purple;">**element index**</mark> is accessed throught [bracket notation \[\]](/web/js/val/obj/prop/access/bracket-notation.md).
  {% endtab %}

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

* Guides ⟩ Arrays ⟩ [Accessing and modifying array items](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/Arrays#accessing_and_modifying_array_items) ⭐️
  {% endtab %}
  {% endtabs %}
