> For the complete documentation index, see [llms.txt](https://strctr.gitbook.io/programming/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://strctr.gitbook.io/programming/01-languages/javascript/01-language/b-structured/b1-arrays/01-arrays.md).

# 01. Arrays

> **Массив** -- это упорядоченная коллекция значений, доступ к элементам которой осуществляется по числовым индексам.

Массивы в языке JS – это специализированная форма объектов, а индексы массивов -- это имена свойств, имеющие цифровой вид. Движки JS обычно оптимизируют операции с массивами, благодаря чему доступ к элементам массивов по их числовым индексам выполняется значительно быстрее, чем доступ к обычным свойствам объектов.

Основные особенности:

* Массивы гетерогенны (могут содержать объекты разных типов).
* Массивы в JavaScript являются динамическими: они могут увеличиваться и уменьшаться в размерах по мере необходимости.
* Массивы в JavaScript могут быть разреженными: не требуется, чтобы массив содержал элементы с непрерывной последовательностью индексов – в массивах могут отсутствовать элементы с некоторыми индексами.
* Все массивы в JavaScript имеют свойство `length`.
* Массивы, как и обычные объекты, могут иметь произвольные свойства, однако данные свойства не являются *элементами массива*. Числовые свойства же интерпретируются как индексы массива.
* Массивы наследуют свои свойства от прототипа `Array.prototype`, который определяет богатый набор методов манипулирования массивами.

Индексы массива -- это 32-х битные целые числа в диапазоне `0 <= i <= 2^32 - 1`. Индексы, выходящие за указанную длину рассматриваются как обычные свойства объекта (строки!), не влияющие на величину `legnth`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://strctr.gitbook.io/programming/01-languages/javascript/01-language/b-structured/b1-arrays/01-arrays.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
