Hi all campers,
So I have a question regarding this challenge.
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array
I am still confused about how this type of function works so I try to manipulate every argument in the function and try to figure it out by myself.
So the answer I have is what is shown on the answer page
var filteredList = watchList.map(watchList => {
return {
title: watchList.Title,
rating: watchList.imdbRating
};
})
.filter(watchList => {
return parseFloat(watchList.rating) >= 8.0;
})
I assume that within title: watchList.Title
and rating: watchList.imdbRating
, both title
and rating
are arbitary variables that I can created by myslef (though I know that in order to pass this challenge I need to set it to title
and rating
), however, for title
I can change it to anything such as name
, but once I change rating
, the function won’t work normally, instead, it returns my an empty array []
.
This one has got me for over 30 min, thanks in advance!