Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
f6c2b06
Date task solution: use standard date time string
jeffchase Mar 1, 2022
1dcf503
add commas
Rnbsov May 6, 2022
88ce8fa
👾 smth
Rnbsov May 12, 2022
98e7e6b
minor fixes
OmerBaddour May 12, 2022
576005b
minor fixes
OmerBaddour May 13, 2022
fb31361
rephrase
joaquinelio May 13, 2022
ad50be1
👾 just add missed break line
Rnbsov May 14, 2022
bb14500
✅ fixed a typo
Rnbsov May 14, 2022
a85e802
👾 remove one extra break line
Rnbsov May 14, 2022
60209e6
👾 just add another one missed break line
Rnbsov May 14, 2022
9cceef1
👾 smth
Rnbsov May 15, 2022
38f5cad
Update about.md (change "data" field to "value")
May 16, 2022
98be74f
⚡ placed missed break line
Rnbsov May 17, 2022
212c527
⚡ add missed break line and remove extra one
Rnbsov May 17, 2022
98899d8
⚡ add missed one
Rnbsov May 17, 2022
f2a4aff
Update article.md
super-salad May 19, 2022
df1523a
👾 add information about test functions to summary section
Rnbsov May 21, 2022
ef5bb39
👾 smth
Rnbsov May 21, 2022
1dc7900
👾smth
Rnbsov May 21, 2022
6d723f4
👾 update `JSdoc` github link
Rnbsov May 22, 2022
1c439bf
just add a comma
imzero9 May 22, 2022
d2e7ac4
typo
joaquinelio May 23, 2022
825cf30
👾fix typo
Rnbsov May 23, 2022
c7cc166
👾 add clarifying example
Rnbsov May 23, 2022
741db31
Update article.md
IamRahulShaw May 25, 2022
95163bb
👾 fix typo
Rnbsov May 27, 2022
293c9b7
👾 smth
Rnbsov May 27, 2022
15ed0d0
👾 add missed break line
Rnbsov May 27, 2022
070b777
👾 smth
Rnbsov May 27, 2022
7dd8d4c
👾 just update link
Rnbsov May 27, 2022
5f28cbb
Add an absent importance value for a closure task
alfemy Jun 2, 2022
41da5cd
updated solution.md
jarede-dev Jun 5, 2022
0ece900
add a method to remove style property
Jun 6, 2022
ec84c3f
difference, is different
joaquinelio Jun 8, 2022
8473bb1
Merge pull request #3043 from joaquinelio/patch-14
iliakan Jun 13, 2022
099881d
Merge pull request #3038 from webFardin/master
iliakan Jun 13, 2022
7a23653
Merge pull request #3015 from super-salad/patch-1
iliakan Jun 13, 2022
5fc0a63
Merge pull request #3037 from jarede-dev/patch-1
iliakan Jun 13, 2022
51c7474
minor fixes
iliakan Jun 13, 2022
248fe0d
Merge pull request #3034 from alfemy/master
iliakan Jun 13, 2022
e4d8547
Merge pull request #3029 from Rnbsov/patch-58
iliakan Jun 13, 2022
05a2b8d
Merge pull request #3028 from Rnbsov/patch-57
iliakan Jun 13, 2022
0934030
Merge pull request #3027 from Rnbsov/patch-56
iliakan Jun 13, 2022
9e72417
Merge pull request #3026 from IamRahulShaw/patch-1
iliakan Jun 13, 2022
7e19bb6
Fixed setTimeout() issue
Jun 13, 2022
da645b5
Merge pull request #3016 from Rnbsov/patch-50
iliakan Jun 13, 2022
dd0ac42
Merge pull request #3017 from Rnbsov/patch-51
iliakan Jun 13, 2022
48106d7
Merge pull request #3018 from Rnbsov/patch-52
iliakan Jun 13, 2022
fff1f64
Merge pull request #3020 from Nayoung-Gu/patch-1
iliakan Jun 13, 2022
dc4d32d
Merge pull request #3021 from joaquinelio/patch-13
iliakan Jun 13, 2022
97202cb
Merge pull request #3023 from Rnbsov/patch-53
iliakan Jun 13, 2022
c028189
Merge pull request #3025 from Rnbsov/patch-55
iliakan Jun 13, 2022
bebcbfa
minor fixes
iliakan Jun 13, 2022
c3b904d
minor fixes
iliakan Jun 14, 2022
2e52d03
Fix typo in text
smith558 Jun 15, 2022
acac4dc
Update article.md
Binu42 Jun 16, 2022
250f9a3
Clarify confusing point
smith558 Jun 16, 2022
556bd7f
Fix grammar and phrasing
smith558 Jun 16, 2022
098f43f
Update text
smith558 Jun 16, 2022
392b191
Merge pull request #3008 from Rnbsov/patch-45
iliakan Jun 18, 2022
82f42cf
Merge pull request #3010 from Rnbsov/patch-47
iliakan Jun 18, 2022
d859d47
Merge pull request #3011 from Rnbsov/patch-48
iliakan Jun 18, 2022
d6ea9ca
Merge pull request #3012 from AmirHasanzade/patch-1
iliakan Jun 18, 2022
325ba6d
Merge pull request #3013 from Rnbsov/patch-49
iliakan Jun 18, 2022
47fec27
Merge pull request #3054 from webFardin/patch-4
iliakan Jun 18, 2022
d81a142
Merge pull request #3056 from smith558/patch-1
iliakan Jun 18, 2022
c08dec6
Merge pull request #3057 from Binu42/patch-1
iliakan Jun 18, 2022
9787f36
Merge pull request #3058 from smith558/patch-2
iliakan Jun 18, 2022
77d8c73
closes #3059
iliakan Jun 18, 2022
964c7db
Merge pull request #3060 from smith558/patch-4
iliakan Jun 18, 2022
8b295f6
closes #3062
iliakan Jun 18, 2022
02b43db
Merge pull request #3005 from joaquinelio/patch-11
iliakan Jun 18, 2022
7febbb9
Merge pull request #2989 from Rnbsov/patch-39
iliakan Jun 18, 2022
c3b5dc1
Merge pull request #3004 from OmerBaddour/master
iliakan Jun 18, 2022
25952f0
Merge pull request #2902 from jeffchase/patch-1
iliakan Jun 18, 2022
727786b
Fix typo
smith558 Jun 18, 2022
ed4a212
closes #3035
iliakan Jun 19, 2022
787638b
👾 smth
Rnbsov Jun 19, 2022
7c3e3e4
Fix language errors and fix broken link
peterhauke Jun 19, 2022
965bd68
Merge pull request #3064 from smith558/patch-1
iliakan Jun 19, 2022
bb6667a
closes #3061
iliakan Jun 19, 2022
2daedb8
closes #3019
iliakan Jun 19, 2022
6d3d668
minor fixes
iliakan Jun 19, 2022
531dced
Merge pull request #3065 from Rnbsov/patch-65
iliakan Jun 19, 2022
903bbbd
fixes #3032
iliakan Jun 19, 2022
4910751
minor fixes
iliakan Jun 19, 2022
7964b11
Merge pull request #3069 from peterhauke/patch-1
iliakan Jun 19, 2022
a91759c
merging all conflicts
iliakan Jun 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions 1-js/01-getting-started/1-intro/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,21 @@ Moderní nástroje provádějí transpilaci velmi rychle a čistě. V podstatě

Příklady takových jazyků:

<<<<<<< HEAD
- [CoffeeScript](http://coffeescript.org/) je „syntaktický cukr“ pro JavaScript, který zavádí kratší syntaxi a tím nám umožňuje psát čistší a přesnější kód. Obvykle jej mají v oblibě vývojáři, kteří používají jazyk Ruby.
- [TypeScript](http://www.typescriptlang.org/) se soustředí na přidání „striktního, silně typovaného systému“, aby zjednodušil vývoj a podporu složitých systémů. Vyvinula jej firma Microsoft.
- [Flow](http://flow.org/) rovněž přidává typovací systém, ale jiným způsobem. Vyvinul jej Facebook.
- [Dart](https://www.dartlang.org/) je samostatný jazyk se svým vlastním enginem, který běží v prostředích mimo prohlížeč (např. v mobilních aplikacích), ale i ten může být transpilován do JavaScriptu. Vyvinut firmou Google.
- [Brython](https://brython.info/) je transpiler Pythonu do JavaScriptu, který umožňuje psát aplikace v čistém Pythonu bez JavaScriptu.
- [Kotlin](https://kotlinlang.org/docs/reference/js-overview.html) je moderní, stručný a bezpečný programovací jazyk, jehož cílem může být prohlížeč nebo Node.
=======
- [CoffeeScript](https://coffeescript.org/) is a "syntactic sugar" for JavaScript. It introduces shorter syntax, allowing us to write clearer and more precise code. Usually, Ruby devs like it.
- [TypeScript](https://www.typescriptlang.org/) is concentrated on adding "strict data typing" to simplify the development and support of complex systems. It is developed by Microsoft.
- [Flow](https://flow.org/) also adds data typing, but in a different way. Developed by Facebook.
- [Dart](https://www.dartlang.org/) is a standalone language that has its own engine that runs in non-browser environments (like mobile apps), but also can be transpiled to JavaScript. Developed by Google.
- [Brython](https://brython.info/) is a Python transpiler to JavaScript that enables the writing of applications in pure Python without JavaScript.
- [Kotlin](https://kotlinlang.org/docs/reference/js-overview.html) is a modern, concise and safe programming language that can target the browser or Node.
>>>>>>> 7964b11b8fa2c314d9a09a82ea4b585cda618c80

Jsou i další. Samozřejmě i když používáme některý z transpilovaných jazyků, měli bychom znát i JavaScript, abychom skutečně porozuměli tomu, co se děje.

Expand Down
5 changes: 5 additions & 0 deletions 1-js/01-getting-started/2-manuals-specifications/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ Pokud vyvíjíte pro prohlížeč, existují i další specifikace uvedené ve [

JavaScript je neustále vyvíjen a pravidelně se do něj přidávají nové vlastnosti.

<<<<<<< HEAD
Chcete-li vědět, v jakých enginech jsou tyto vlastnosti už podporovány, podívejte se na:
=======
- <https://caniuse.com> - per-feature tables of support, e.g. to see which engines support modern cryptography functions: <http://caniuse.com/#feat=cryptography>.
- <https://kangax.github.io/compat-table> - a table with language features and engines that support those or don't support.
>>>>>>> 7964b11b8fa2c314d9a09a82ea4b585cda618c80

- <http://caniuse.com> - pro každou vlastnost obsahuje tabulku enginů, které ji podporují, např. chcete-li vidět, které enginy podporují moderní kryptografické funkce, jděte na <http://caniuse.com/#feat=cryptography>.
- <https://kangax.github.io/compat-table> - tabulka vlastností jazyka a enginů, které je podporují nebo nepodporují.
Expand Down
5 changes: 5 additions & 0 deletions 1-js/01-getting-started/3-code-editors/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ IDE načítá projekt (který se může skládat z mnoha souborů), umožňuje n

Pokud jste si IDE ještě nevybrali, zvažte následující možnosti:

<<<<<<< HEAD
- [Visual Studio Code](https://code.visualstudio.com/) (různé platformy, zdarma).
- [WebStorm](http://www.jetbrains.com/webstorm/) (různé platformy, placené).
=======
- [Visual Studio Code](https://code.visualstudio.com/) (cross-platform, free).
- [WebStorm](https://www.jetbrains.com/webstorm/) (cross-platform, paid).
>>>>>>> 7964b11b8fa2c314d9a09a82ea4b585cda618c80

Pro Windows existuje také „Visual Studio“ (nezaměňovat s „Visual Studio Code“), což je placený, ale silný editor pouze pro Windows, velmi vhodný pro platformu .NET, který funguje dobře i pro JavaScript. Má i neplacenou verzi [Visual Studio Community](https://www.visualstudio.com/vs/community/).

Expand Down
19 changes: 19 additions & 0 deletions 1-js/02-first-steps/04-variables/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ let věk = 25;
let zpráva = 'Ahoj';
```

<<<<<<< HEAD
Někteří lidé definují více proměnných i tímto víceřádkovým stylem:
=======
Some people also define multiple variables in this multiline style:

>>>>>>> 7964b11b8fa2c314d9a09a82ea4b585cda618c80
```js no-beautify
let uživatel = 'Jan',
věk = 25,
Expand Down Expand Up @@ -102,7 +107,12 @@ Například proměnnou `zpráva` si můžeme představit jako krabičku se ští

Do krabičky můžeme uložit libovolnou hodnotu.

<<<<<<< HEAD
Můžeme ji také změnit tolikrát, kolikrát chceme:
=======
We can also change it as many times as we want:

>>>>>>> 7964b11b8fa2c314d9a09a82ea4b585cda618c80
```js run
let zpráva;

Expand Down Expand Up @@ -260,8 +270,12 @@ mojeDatumNarození = '01.01.2001'; // chyba, nelze změnit konstantu!

Když má programátor jistotu, že hodnota proměnné se nikdy nezmění, může ji deklarovat pomocí `const`, aby tuto skutečnost pojistil a všem jasně sdělil.

<<<<<<< HEAD

### Konstanty velkými písmeny
=======
### Uppercase constants
>>>>>>> 7964b11b8fa2c314d9a09a82ea4b585cda618c80

Je široce rozšířenou praktikou používat konstanty jako názvy obtížně zapamatovatelných hodnot, které jsou známy ještě před spuštěním programu.

Expand Down Expand Up @@ -290,7 +304,12 @@ Kdy bychom měli používat pro konstantu velká písmena a kdy bychom ji měli

Být „konstanta“ znamená prostě to, že hodnota proměnné se nikdy nezmění. Existují však konstanty, které jsou známy již před spuštěním programu (například hexadecimální hodnota červené barvy), a pak jsou konstanty, které se *vypočítají* až za běhu programu, ale jejich vypočtená hodnota se nikdy nezmění.

<<<<<<< HEAD
Příklad:
=======
For instance:

>>>>>>> 7964b11b8fa2c314d9a09a82ea4b585cda618c80
```js
const dobaNačítáníStránky = /* doba, kterou trvá načíst webovou stránku */;
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The answer: `null`, because it's the first falsy value from the list.

```js run
alert( 1 && null && 2 );
alert(1 && null && 2);
```

20 changes: 17 additions & 3 deletions 1-js/02-first-steps/13-while-for/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ For example, outputting goods from a list one after another or just running the

*Loops* are a way to repeat the same code multiple times.

```smart header="The for..of and for..in loops"
A small announcement for advanced readers.

This article covers only basic loops: `while`, `do..while` and `for(..;..;..)`.

If you came to this article searching for other types of loops, here are the pointers:

- See [for..in](info:object#forin) to loop over object properties.
- See [for..of](info:array#loops) and [iterables](info:iterable) for looping over arrays and iterable objects.

Otherwise, please read on.
```

## The "while" loop

The `while` loop has the following syntax:
Expand Down Expand Up @@ -162,10 +175,8 @@ for (i = 0; i < 3; i++) { // use an existing variable

alert(i); // 3, visible, because declared outside of the loop
```

````


### Skipping parts

Any part of `for` can be skipped.
Expand Down Expand Up @@ -286,7 +297,6 @@ if (i > 5) {

...and rewrite it using a question mark:


```js no-beautify
(i > 5) ? alert(i) : *!*continue*/!*; // continue isn't allowed here
```
Expand Down Expand Up @@ -321,6 +331,7 @@ We need a way to stop the process if the user cancels the input.
The ordinary `break` after `input` would only break the inner loop. That's not sufficient -- labels, come to the rescue!

A *label* is an identifier with a colon before a loop:

```js
labelName: for (...) {
...
Expand All @@ -342,6 +353,7 @@ The `break <labelName>` statement in the loop below breaks out to the label:
// do something with the value...
}
}

alert('Done!');
```

Expand All @@ -362,13 +374,15 @@ The `continue` directive can also be used with a label. In this case, code execu
Labels do not allow us to jump into an arbitrary place in the code.

For example, it is impossible to do this:

```js
break label; // jump to the label below (doesn't work)

label: for (...)
```

A `break` directive must be inside a code block. Technically, any labelled code block will do, e.g.:

```js
label: {
// ...
Expand Down
2 changes: 1 addition & 1 deletion 1-js/03-code-quality/03-comments/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Such comments allow us to understand the purpose of the function and use it the

By the way, many editors like [WebStorm](https://www.jetbrains.com/webstorm/) can understand them as well and use them to provide autocomplete and some automatic code-checking.

Also, there are tools like [JSDoc 3](https://github.com/jsdoc3/jsdoc) that can generate HTML-documentation from the comments. You can read more information about JSDoc at <https://jsdoc.app>.
Also, there are tools like [JSDoc 3](https://github.com/jsdoc/jsdoc) that can generate HTML-documentation from the comments. You can read more information about JSDoc at <https://jsdoc.app>.

Why is the task solved this way?
: What's written is important. But what's *not* written may be even more important to understand what's going on. Why is the task solved exactly this way? The code gives no answer.
Expand Down
2 changes: 1 addition & 1 deletion 1-js/04-object-basics/01-object/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ In the code above, the property `obj.test` technically exists. So the `in` opera
Situations like this happen very rarely, because `undefined` should not be explicitly assigned. We mostly use `null` for "unknown" or "empty" values. So the `in` operator is an exotic guest in the code.


## The "for..in" loop
## The "for..in" loop [#forin]

To walk over all keys of an object, there exists a special form of the loop: `for..in`. This is a completely different thing from the `for(;;)` construct that we studied before.

Expand Down
2 changes: 1 addition & 1 deletion 1-js/04-object-basics/03-garbage-collection/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ The first step marks the roots:

![](garbage-collection-2.svg)

Then we follow their references are mark referenced objects:
Then we follow their references and mark referenced objects:

![](garbage-collection-3.svg)

Expand Down
2 changes: 1 addition & 1 deletion 1-js/04-object-basics/04-object-methods/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ user = {

As demonstrated, we can omit `"function"` and just write `sayHi()`.

To tell the truth, the notations are not fully identical. There are subtle differences related to object inheritance (to be covered later), but for now they do not matter. In almost all cases the shorter syntax is preferred.
To tell the truth, the notations are not fully identical. There are subtle differences related to object inheritance (to be covered later), but for now they do not matter. In almost all cases, the shorter syntax is preferred.

## "this" in methods

Expand Down
16 changes: 12 additions & 4 deletions 1-js/05-data-types/02-number/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ In modern JavaScript, there are two types of numbers:

1. Regular numbers in JavaScript are stored in 64-bit format [IEEE-754](https://en.wikipedia.org/wiki/IEEE_754-2008_revision), also known as "double precision floating point numbers". These are numbers that we're using most of the time, and we'll talk about them in this chapter.

2. BigInt numbers, to represent integers of arbitrary length. They are sometimes needed, because a regular number can't safely exceed <code>2<sup>53</sup></code> or be less than <code>-2<sup>53</sup></code>. As bigints are used in few special areas, we devote them a special chapter <info:bigint>.
2. BigInt numbers represent integers of arbitrary length. They are sometimes needed because a regular number can't safely exceed <code>2<sup>53</sup></code> or be less than <code>-2<sup>53</sup></code>. As bigints are used in few special areas, we devote them a special chapter <info:bigint>.

So here we'll talk about regular numbers. Let's expand our knowledge of them.

Expand Down Expand Up @@ -50,7 +50,7 @@ let mсs = 0.000001;
Just like before, using `"e"` can help. If we'd like to avoid writing the zeroes explicitly, we could write the same as:

```js
let mcs = 1e-6; // six zeroes to the left from 1
let mcs = 1e-6; // five zeroes to the left from 1
```

If we count the zeroes in `0.000001`, there are 6 of them. So naturally it's `1e-6`.
Expand All @@ -63,6 +63,9 @@ In other words, a negative number after `"e"` means a division by 1 with the giv

// -6 divides by 1 with 6 zeroes
1.23e-6 === 1.23 / 1000000; // 0.00000123

// an example with a bigger number
1234e-2 === 1234 / 100; // 12.34, decimal point moves 2 times
```

### Hex, binary and octal numbers
Expand Down Expand Up @@ -305,7 +308,7 @@ They belong to the type `number`, but are not "normal" numbers, so there are spe
alert( isNaN("str") ); // true
```

But do we need this function? Can't we just use the comparison `=== NaN`? Sorry, but the answer is no. The value `NaN` is unique in that it does not equal anything, including itself:
But do we need this function? Can't we just use the comparison `=== NaN`? Unfortunately not. The value `NaN` is unique in that it does not equal anything, including itself:

```js run
alert( NaN === NaN ); // false
Expand Down Expand Up @@ -399,7 +402,7 @@ A few examples:
alert( Math.random() ); // ... (any random numbers)
```

`Math.max(a, b, c...)` / `Math.min(a, b, c...)`
`Math.max(a, b, c...)` and `Math.min(a, b, c...)`
: Returns the greatest/smallest from the arbitrary number of arguments.

```js run
Expand Down Expand Up @@ -429,6 +432,11 @@ For different numeral systems:
- `parseInt(str, base)` parses the string `str` into an integer in numeral system with given `base`, `2 ≤ base ≤ 36`.
- `num.toString(base)` converts a number to a string in the numeral system with the given `base`.

For regular number tests:

- `isNaN(value)` converts its argument to a number and then tests it for being `NaN`
- `isFinite(value)` converts its argument to a number and returns `true` if it's a regular number, not `NaN/Infinity/-Infinity`

For converting values like `12pt` and `100px` to a number:

- Use `parseInt/parseFloat` for the "soft" conversion, which reads a number from a string and then returns the value they could read before the error.
Expand Down
14 changes: 7 additions & 7 deletions 1-js/05-data-types/04-array/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ The "trailing comma" style makes it easier to insert/remove items, because all l

[recent browser="new"]

Let's say we want a last element of the array.
Let's say we want the last element of the array.

Some programming languages allow to use negative indexes for the same purpose, like `fruits[-1]`.

Expand Down Expand Up @@ -153,9 +153,9 @@ A stack is usually illustrated as a pack of cards: new cards are added to the to

For stacks, the latest pushed item is received first, that's also called LIFO (Last-In-First-Out) principle. For queues, we have FIFO (First-In-First-Out).

Arrays in JavaScript can work both as a queue and as a stack. They allow you to add/remove elements both to/from the beginning or the end.
Arrays in JavaScript can work both as a queue and as a stack. They allow you to add/remove elements, both to/from the beginning or the end.

In computer science the data structure that allows this, is called [deque](https://en.wikipedia.org/wiki/Double-ended_queue).
In computer science, the data structure that allows this, is called [deque](https://en.wikipedia.org/wiki/Double-ended_queue).

**Methods that work with the end of the array:**

Expand Down Expand Up @@ -281,7 +281,7 @@ Why is it faster to work with the end of an array than with its beginning? Let's
fruits.shift(); // take 1 element from the start
```

It's not enough to take and remove the element with the number `0`. Other elements need to be renumbered as well.
It's not enough to take and remove the element with the index `0`. Other elements need to be renumbered as well.

The `shift` operation must do 3 things:

Expand Down Expand Up @@ -399,11 +399,11 @@ There is one more syntax to create an array:
let arr = *!*new Array*/!*("Apple", "Pear", "etc");
```

It's rarely used, because square brackets `[]` are shorter. Also there's a tricky feature with it.
It's rarely used, because square brackets `[]` are shorter. Also, there's a tricky feature with it.

If `new Array` is called with a single argument which is a number, then it creates an array *without items, but with the given length*.

Let's see how one can shoot themself in the foot:
Let's see how one can shoot themselves in the foot:

```js run
let arr = new Array(2); // will it create an array of [2] ?
Expand Down Expand Up @@ -530,7 +530,7 @@ The call to `new Array(number)` creates an array with the given length, but with
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`.
- also we can use `at(i)` method that allows negative indexes. For negative values of `i`, it steps back from the end of the array. If `i >= 0`, it works same as `arr[i]`.

We can use an array as a deque with the following operations:

Expand Down
Loading