# Functional Programming: Use the reduce Method to Analyze Data_Help Requested

Hello. I wondered if I could get some help with this challenge. It is outputting the wrong number. Thanks in advance!

``````let newArr = watchList.filter(function(e){
return e.Director = "Christopher Nolan";
})

let newArrWithNum = newArr.map(function(e) {
return Number(e.imdbRating);
})

let averageRating = newArrWithNum.reduce(function(x,y) {
let sum = x + y;
return sum / newArrWithNum.length;
})
``````

Is this meant to be an assignment or a comparison?

I’ve fixed it so it’s a comparison, but it’s still outputting the wrong number.

``````let newArr = watchList.filter(function(e){
return e.Director === "Christopher Nolan";
})

let newArrWithNum = newArr.map(function(e) {
return Number(e.imdbRating);
})

let averageRating = newArrWithNum.reduce(function(x,y) {
let sum = x + y;
return sum / newArrWithNum.length;
})
``````

this part here is not working, try reading again the documentation on the reduce method

Your code does this: (which is not an average)
considering an array with for items, each letter is the result from one passage of the function.

``````a = (arr[0] + arr[1]) / arr.length
b = (a + arr[2]) / arr.length
c = (b + arr[3]) / arr.length

result = (((arr[0] + arr[1]) / arr.length + arr[2]) / arr.length + arr[3]) / arr.length

``````

Ah, I got it. Thanks!