Help me what is wrong in my code

Tell us what’s happening:
it is returning an empty array after i have applied filter on the filteredlist

Your code so far

// Only change code below this line

function myFun(movie){

  return parseFloat(movie.imdbRating) >= 8.0;


const filteredList = => ({title : item.Title, rating : item.imdbRating})).filter(myFun)

// Only change code above this line


Your browser information:

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

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

Link to the challenge:

What are the two remaining properties in each object of the list after you run it through map? What property are you testing on in myFun?

the properties for map is “title, imdbrating” and for filter it is the imdbrating > 8.0.
the array is not here in this post tho.

That’s what they are in the original array. What are they after you run the array through map?

the are key values for object… it is written like ‘‘Title , imdbRating’’ in case sensitive. but the map part is working fine the filter part is returning empty array in console.

i dont know if i answered what you intend to ask so i apologize

Tell me what this does: => ({title : item.Title, rating : item.imdbRating}))

Give me an example of what this returns.

ok … it return the title and ratings from the array objects

\\console results
[ { title: 'Inception', rating: '8.8' },
  { title: 'Interstellar', rating: '8.6' },
  { title: 'The Dark Knight', rating: '9.0' },
  { title: 'Batman Begins', rating: '8.3' },
  { title: 'Avatar', rating: '7.9' } ]

now i need to filter the rating which are > 8.0

1 Like