Stuck on Lesson: Use Filter to Extract Data from an Array

Link to Challenge](

My code so far:

//This rating code is good so far:

let rating = []

rating = => {
  let emptyObj = {}
  let {Title, imdbRating} = movie
  emptyObj['title'] = Title
  emptyObj['rating'] = imdbRating
  return emptyObj

// highRating code is giving me an empty array. 

let highRating = []

highRating = rating.filter(
  over8 => parseFloat(over8['imdbRating']) >= 8.0


I understand the code could be done more succinctly since I had a peek at the solution. But I want to fix the code that I was able to come up with myself.

I am able to meet the first half of the criteria set by the challenge. 1) I have not mutated the global variable watchList. 2) I am able to return a new array, rating, with a list of objects as its elements with just the movies’ Title and their imdbRating.

My highRating array, however, returns just an empty array. Here is my logic for my highRating code:
On my rating array, call the filter method. The filter method’s parameter, over8, takes in each element in the rating’s array which is an object as its argument. The filter method also contains a callback function in which I find the value of the imbdRating and convert it from a string to decimal number which I then perform a comparison operator. If it is greater than or equal to 8.0, it evaluates to true and the object is added to the new array highRating. The movie “Avatar” should not be added b/c its rating is 7.9.

Where did I make my mistake?


Yeah, I see what the issue is now. Thanks!