Easy
This question is a daily question and will count towards your daily streak.
You are writing a program to analyze student grades. Each grade is stored as an object in an array, with properties student and score. You need to calculate the average score of students who scored above 75. Which is the correct way to calculate this?
1const grades = [2 { student: "Alice", score: 85 },3 { student: "Bob", score: 72 },4 { student: "Charlie", score: 90 },5 { student: "Diana", score: 65 },6 { student: "Eve", score: 78 },7];89const average = grades10 .filter((grade) => /* condition */)11 .reduce((sum, grade, _, array) => {12 return sum + grade.score / array.length;13 }, 0);1415console.log(average);