Map>filter/filter>map

I have a little bit different from the hint solution where I filter first then map. idk if this is more simple or will be a problem later. I need your opinion! Thank you :slight_smile:

 const filteredList = watchList.filter(function(watchList) {
  return watchList.imdbRating >= 8.0;
}).map(function(watchList) {
  return {
    title: watchList.Title,
    rating: watchList.imdbRating
  };
});

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 OPR/82.0.4227.43

Challenge: Use the filter Method to Extract Data from an Array

Link to the challenge:

The hint-solution is only an example. Especially when it comes to more complex tasks, there are several possible and equally valid solutions.
If it works, that’s all that matters :wink:

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