**Tell us what’s happening:**I need some help. My code is returning the average imdb rating of 10.65
Your code so far
WARNING
The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.
You will need to take an additional step here so the code you wrote presents in an easy to read format.
Please copy/paste all the editor code showing in the challenge from where you just linked.
function getRating(watchList) {
// Only change code below this line
let averageRating = watchList
.filter(movie => movie.imdbRating >= 8.0)
.map(movie =>({title: movie["Title"], rating: movie["imdbRating"], director: movie["Director"]}));
// Only change code above this line
return averageRating = watchList.reduce((sum, movie) => sum + movie.imdbRating / averageRating.length, 0);
}
console.log(getRating(watchList));
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Challenge: Functional Programming - Use the reduce Method to Analyze Data
Link to the challenge: