Use the reduce Method to Analyze Data (Help)

Tell us what’s happening:

my .map() return the numerical value like ['8.8, ‘8’] as string instead of just Numbers.

Your code so far



// Add your code below this line

var averageRating = watchList.filter(function (movie){
  return movie.Director === "Christopher Nolan";
}).map(function (movie) {
  return Number = movie.imdbRating;
});

// Add your code above this line

console.log(averageRating); 

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data/

Number is a function, so you can call it like other function passing the move.imdbRating to it.

Also, you are supposed to use reduce to calculate an average rating of the Christopher Nolan movies. Once you fix the issue I first mentioned, you need to sum the ratings and divided by the number of movies directed by Christopher Nolan.

Thank you so much. I finally solved the problem…