Map en objets
Vous avez un tableau d’objets user, chacun ayant name, surname et id.
Ecrivez le code pour créer un autre tableau à partir de celui-ci, avec les objets id et fullName, où fullName est généré à partir de name et surname.
Par exemple:
Donc, en réalité, vous devez mapper un tableau d’objets sur un autre. Essayez d’utiliser => ici. Il y a une petite prise.
Please note that in the arrow functions we need to use additional brackets.
We can’t write like this:
As we remember, there are two arrow functions: without body value => expr and with body value => {...}.
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:
Now fine.