Question on Filters

// Only change code below this line

let filteredList = watchList
.map(function(filteredList) {
  return {
    "title": "Inception", 
    "rating": 8.8, 
    "title": "Interstellar",
    "rating": 8.6, 
    "title": "The Dark Knight", 
    "rating": 9.0, 
    "title": "Batman Begins", 
    "rating": 8.3
  }
  .filter((filteredList) => imdbRating >= 8.0);
})


// Only change code above this line

// I am still getting an error for the watchList variable changing, and I’m not sure how to arrange the filteredList in another way using the filter method. Thank you

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

Link to the challenge:

I don’t understand this mapping function. You shouldn’t manually try to map by hand. That isn’t an appropriate approach because you would need to manually change this for any change in the input data.

Instead, your map function should describe how to create new objects in an array from the old objects in your old array.

Also, it is recommended to filter before you map.

1 Like