You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
1192
1192
1193
1193
```js
1194
1194
[1, 2, 3].map((v) => v +1)
1195
1195
// -> [2, 3, 4]
1196
1196
```
1197
1197
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.
1199
1199
1200
1200
```js
1201
1201
['1','2','3'].map(parseInt)
@@ -1204,14 +1204,14 @@ The effect of `Map` is to generate a new array, iterate over the original array,
1204
1204
// parseInt('3', 2) -> NaN
1205
1205
```
1206
1206
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.
1208
1208
1209
1209
```js
1210
1210
[1, [2], 3].flatMap((v) => v +1)
1211
1211
// -> [2, 3, 4]
1212
1212
```
1213
1213
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:
0 commit comments