Skip to content

Commit 49cc586

Browse files
author
Adria Vieira
committed
Map objects task translated
1 parent 7cf4aa1 commit 49cc586

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

1-js/05-data-types/05-array-methods/7-map-objects/solution.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,19 @@ alert( usersMapped[0].id ); // 1
2525
alert( usersMapped[0].fullName ); // John Smith
2626
```
2727

28-
Please note that in for the arrow functions we need to use additional brackets.
28+
Por favor, note que para usar arrow functions, precisamos usar colchetes adicionais.
2929

30-
We can't write like this:
30+
Não podemos escrevê-lo dessa forma:
3131
```js
3232
let usersMapped = users.map(user => *!*{*/!*
3333
fullName: `${user.name} ${user.surname}`,
3434
id: user.id
3535
});
3636
```
3737

38-
As we remember, there are two arrow functions: without body `value => expr` and with body `value => {...}`.
38+
Como sabemos, existem dois tipos de arrow functions: sem corpo `value => expr` e com corpo `value => {...}`.
3939

40-
Here JavaScript would treat `{` as the start of function body, not the start of the object. The workaround is to wrap them in the "normal" brackets:
40+
JavaScript irá tratar `{` como o começo do corpo de uma função, não o começo do objeto. A *gambiarra* é os colocar em volta de colchetes "normais", ou seja, primeiro os parênteses e depois os colchetes `({ ... })`:
4141

4242
```js
4343
let usersMapped = users.map(user => *!*({*/!*
@@ -46,6 +46,6 @@ let usersMapped = users.map(user => *!*({*/!*
4646
}));
4747
```
4848

49-
Now fine.
49+
Dessa forma, nosso código está correto.
5050

5151

1-js/05-data-types/05-array-methods/7-map-objects/task.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ importance: 5
44

55
# Map to objects
66

7-
You have an array of `user` objects, each one has `name`, `surname` and `id`.
7+
Você tem um array de objetos `user`, cada um possui `name`, `surname` e `id`.
88

9-
Write the code to create another array from it, of objects with `id` and `fullName`, where `fullName` is generated from `name` and `surname`.
9+
Escreva um código para criar um novo array a partir de `user`, também será um array de objetos com as chaves `id` e `fullName`, onde `fullName` é gerado a partir da junção de `name` e `surname`.
1010

11-
For instance:
11+
Exemplo:
1212

1313
```js no-beautify
1414
let john = { name: "John", surname: "Smith", id: 1 };
@@ -18,7 +18,7 @@ let mary = { name: "Mary", surname: "Key", id: 3 };
1818
let users = [ john, pete, mary ];
1919

2020
*!*
21-
let usersMapped = /* ... your code ... */
21+
let usersMapped = /* ... seu código ... */
2222
*/!*
2323

2424
/*
@@ -33,4 +33,4 @@ alert( usersMapped[0].id ) // 1
3333
alert( usersMapped[0].fullName ) // John Smith
3434
```
3535

36-
So, actually you need to map one array of objects to another. Try using `=>` here. There's a small catch.
36+
Então, na realidade, você precisa copiar um array de objetos para o outro. Tente usar `=>` aqui. Há uma pegadinha neste exercício.

0 commit comments

Comments
 (0)