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;
})
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;
})