What is the difference between {} and ( ) in JavaScript's return statement?
const fruits = [
{
name: "FaceBook",
nickname: "FB",
},
{
name: "Youtube",
nickname: "YT",
},
{
name: "AmazonWebService",
nickname: "AWS",
},
];
const count = fruits.reduce((acc, cur) => {
return { ...acc, [cur.nickname]: cur.name }; // What does {} of return mean here?
}, {});
Aucun commentaire:
Enregistrer un commentaire