Tell us what’s happening:
So I have the correct solution(i found it in the solutions tab) and my solution was basically correct but it didnt have the extra parenthesis after the arrow in the arrow function. my question is why are these needed? in the example code:
const names = users.map(user => user.name);
the parenthesis are not there and instead theres only one set of parenthesis after .map. is it because its on multiple lines? or maybe because the function is more complicated?
If you have {}, the arrow function is expecting a function body with an explicit return statement. This is inconvenient when we want to return an object. So you wrap the object literal in () to let JS know that you are returning an object literal rather than putting a function body between the {}s.
Often, when you have questions like this, it’s likely a point of confusion for others. Part of freecodecamp’s Read-Research-ask is searching past posts on this very forum: