Skip to content

Commit ca90e8d

Browse files
committed
Finished Map and anothers
1 parent 8a64840 commit ca90e8d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

JS/JS-br.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
- [Implementação do Generator](#implementação-do-generator)
3030
- [Debouncing](#debouncing)
3131
- [Throttle](#throttle)
32-
- [Map、FlatMap e Reduce](#mapflatmap-and-reduce)
32+
- [Map、FlatMap e Reduce](#mapflatmap-e-reduce)
3333
- [Async e await](#async-and-await)
3434
- [Proxy](#proxy)
3535
- [Por que 0.1 + 0.2 != 0.3](#why-01--02--03)
@@ -1186,16 +1186,16 @@ _.throttle = function(func, wait, options) {
11861186
};
11871187
```
11881188
1189-
# Map、FlatMap and Reduce
1189+
# Map、FlatMap e Reduce
11901190
1191-
The effect of `Map` is to generate a new array, iterate over the original array, take each element out to do some transformation, and then `append` to the new array.
1191+
O efeito do `Map` é para gerar um novo array, iterando sobre o array original, tomando cada elemento para fazer alguma transformação, e então `append` para um novo array.
11921192
11931193
```js
11941194
[1, 2, 3].map((v) => v + 1)
11951195
// -> [2, 3, 4]
11961196
```
11971197
1198-
`Map` has three parameters, namely the current index element, the index, the original array.
1198+
`Map` tem três parâmetros, nomeando o índice atual do elemento, o índice, o array original.
11991199
12001200
```js
12011201
['1','2','3'].map(parseInt)
@@ -1204,14 +1204,14 @@ The effect of `Map` is to generate a new array, iterate over the original array,
12041204
// parseInt('3', 2) -> NaN
12051205
```
12061206
1207-
The effect of `FlatMap` is almost the same with a `Map`, but the original array will be flatten for multidimensional arrays. You can think of `FlatMap` as a `map` and a `flatten`, which is currently not supported in browsers.
1207+
O efeito do `FlatMap` é quase o mesmo do `Map`, mas o array original será substituído para um array multidimensional. Você pode pensar no `FlatMap` com um `map` e um `flatten`, que atualmente não é suportado nos navegadores.
12081208
12091209
```js
12101210
[1, [2], 3].flatMap((v) => v + 1)
12111211
// -> [2, 3, 4]
12121212
```
12131213
1214-
You can achieve this when you want to completely reduce the dimensions of a multidimensional array:
1214+
Você pode alcançar isso quando você quer reduzir completamente dimensões de um array multidimensional:
12151215
12161216
```js
12171217
const flattenDeep = (arr) => Array.isArray(arr)
@@ -1221,7 +1221,7 @@ const flattenDeep = (arr) => Array.isArray(arr)
12211221
flattenDeep([1, [[2], [3, [4]], 5]])
12221222
```
12231223
1224-
The effect of `Reduce` is to combine the values in the array and get a final value:
1224+
O efeito do `Reduce` é para combinar os valores em um array e pegar o valor final:
12251225
12261226
```js
12271227
function a() {

0 commit comments

Comments
 (0)