Last check: Use the reduce Method to Analyze Data

Hi everyone,
I’m trying to solve the problem, but it doesn’t pass the last check point.
The code below is what I tryed.
Has someone an idea where’s the mistake?

function getRating(watchList){
  // Only change code below this line
  var averageRating = watchList
    .filter(x => x.Director == "Christopher Nolan")
    .map(x=> parseFloat(x.imdbRating))
    .reduce((avg, item) => (avg*2 + item) / 2, 0) / 2;
  // Add your code above this line
  return averageRating;

what’s the challenge you are doing? can you give the link?

in the challenge page there is an Ask for help button that would create a precompiled post with all the useful infos already included. Next time, please use that.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.


It looks like the answer breaks when you divide the totals by 2 right at the end. If you can devise a way to get the correct average without the division at the end, it will pass.