Use the filter method to extract data from an array ... stay calme :)

I do not understand why this solution works perfectly with my code editor and not with the freecodecamp

let filteredList = watchList.map(item => ({Title:item["Title"],rating:item["imdbRating"]}));

filteredList = filteredList.filter(item => item["rating"] > 8);

console.log(filteredList);

while the freecodecamp solution :slight_smile:

var filteredList = watchList.map(function(e) {

return {title: e["Title"], rating: e["imdbRating"]}

}).filter((e) => e.rating >= 8);

console.log(filteredList);

return exactly the same table to my code editor and Google Chrome browser.

but on the other hand works perfectly with Fcc

:sweat_smile:

1 Like

Could use the link to the exercise, but just looking over it now, there is a difference in your filteredList.filter(): the fcc solution you quote is looking for >= and you are just looking for >

https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array

Thanks for the answer but it does not change absolutely anything. :smiley:

You may have chsnged or invisible characters, for example I see often a => in your code, which may be the >

That may give you issues in executing right the code

I found it!
Title:item["Title"] !== title: e["Title"]

if you still aren’t seeing it, let’s make the variables and the spacing match:
Title: item["Title"] !== title: item["Title"]