How does reduce() work here?

Your ()s are not identical to the solution. I can only say that so many ways. Look at where every single pair opens and closes in the code I posted directly from the solutions page.

  // filter the collection
  return collection.filter(obj => souceKeys
      .map(key => obj.hasOwnProperty(key) && obj[key] === source[key])
      .reduce((a, b) => a && b)
   ); // <---- LOOK RIGHT HERE

1 Like

Start counting left and right parens :slight_smile: I’ll ask again, do you want to reduce the results of the map, or the results of the filter?

2 Likes

I finally got it, so it was all about the () placement.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.