Filter and map method combined

Please can someone enlighten me. The following was my solution and shows the correct array of objects in the window, however when I click run tests it doesn’t pass. I’m not sure if I’m completely missing something here. I notice in the solutions that a return is used but I didn’t think return was needed when using an arrow function. Thanks in advance.

[spoiler]var filteredList = watchList.map(item => ({

  title: item["Title"],

  rating: Number(item["imdbRating"])

}))

.filter(item => item.rating >= 8.0);
[/spoiler]

Your browser information:

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

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

Link to the challenge:

You’re returning rating as a number. I suspect that it might be expecting a string.

1 Like

Of course! Thank you for pointing out the obvious. I misread the instructions as requiring the rating values to be numbers rather than strings. Thanks again.

It happens to us all. Happy coding!