This commit is contained in:
Ilya Kantor 2019-07-31 00:46:04 +03:00
parent a8f90e8e9f
commit bbf98b2ef0
4 changed files with 6 additions and 7 deletions

View file

@ -236,7 +236,7 @@ In that case the visitor may choose `__proto__` as the key, and the assignment l
There is a way to make objects treat `__proto__` as a regular property, which we'll cover later, but first we need to know more about objects. There is a way to make objects treat `__proto__` as a regular property, which we'll cover later, but first we need to know more about objects.
There's also another data structure [Map](info:map-set-weakmap-weakset), that we'll learn in the chapter <info:map-set-weakmap-weakset>, which supports arbitrary keys. There's also another data structure [Map](info:map-set), that we'll learn in the chapter <info:map-set>, which supports arbitrary keys.
```` ````

View file

@ -36,4 +36,4 @@ So if `arr.length` is `10000` we'll have something like `10000*10000` = 100 mill
So the solution is only good for small arrays. So the solution is only good for small arrays.
Further in the chapter <info:map-set-weakmap-weakset> we'll see how to optimize it. Further in the chapter <info:map-set> we'll see how to optimize it.

View file

@ -45,7 +45,7 @@ for (let key in count) {
} }
``` ```
An example result (for V8, July 2017): An example result (depends on JS engine):
```js ```js
123: 250706 123: 250706

View file

@ -581,8 +581,7 @@ Or in the form of a table, where each row represents a function call on the next
|the fourth call|`6`|`4`|`10`| |the fourth call|`6`|`4`|`10`|
|the fifth call|`10`|`5`|`15`| |the fifth call|`10`|`5`|`15`|
Here we can clearly see how the result of the previous call becomes the first argument of the next one.
As we can see, the result of the previous call becomes the first argument of the next one.
We also can omit the initial value: We also can omit the initial value:
@ -654,7 +653,7 @@ arr.map(func, thisArg);
The value of `thisArg` parameter becomes `this` for `func`. The value of `thisArg` parameter becomes `this` for `func`.
For instance, here we use an object method as a filter and `thisArg` comes in handy: For instance, here we use an object method as a filter and `thisArg` helps with that:
```js run ```js run
let user = { let user = {
@ -726,7 +725,7 @@ These methods are the most used ones, they cover 99% of use cases. But there are
For the full list, see the [manual](mdn:js/Array). For the full list, see the [manual](mdn:js/Array).
From the first sight it may seem that there are so many methods, quite difficult to remember. But actually that's much easier than it seems. From the first sight it may seem that there are so many methods, quite difficult to remember. But actually that's much easier.
Look through the cheat sheet just to be aware of them. Then solve the tasks of this chapter to practice, so that you have experience with array methods. Look through the cheat sheet just to be aware of them. Then solve the tasks of this chapter to practice, so that you have experience with array methods.