From 598ca68f21c82d3914d891c683f64df47e4e4b45 Mon Sep 17 00:00:00 2001 From: Lavrentiy Rubtsov Date: Mon, 9 May 2022 08:31:22 +0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=BE=20Update=20summary=20section?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1-js/05-data-types/04-array/article.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/1-js/05-data-types/04-array/article.md b/1-js/05-data-types/04-array/article.md index 95a78f29..ccbc0ba1 100644 --- a/1-js/05-data-types/04-array/article.md +++ b/1-js/05-data-types/04-array/article.md @@ -512,7 +512,7 @@ That's simple: don't use the `==` operator. Instead, compare them item-by-item i Array is a special kind of object, suited to storing and managing ordered data items. -- The declaration: +The declaration: ```js // square brackets (usual) @@ -527,6 +527,11 @@ Array is a special kind of object, suited to storing and managing ordered data i - The `length` property is the array length or, to be precise, its last numeric index plus one. It is auto-adjusted by array methods. - If we shorten `length` manually, the array is truncated. +Getting the elements: + +- we can get element by its index, like `arr[0]` +- also we can use `at(i)` method to get negative-index elements, for negative values of `i`, it steps back from the end of the array. In the rest it works same as `arr[i]`, if `i >= 0`. + We can use an array as a deque with the following operations: - `push(...items)` adds `items` to the end.