Tell us what’s happening:
the code is correct still its not working tried 100 times
Your code so far
function getAverage(scores) {
const total = scores.reduce((sum, score) => sum + score, 0);
return total / scores.length;
}
function getGrade(score) {
if (score === 100) return "A+";
if (score >= 90) return "A";
if (score >= 80) return "B";
if (score >= 70) return "C";
if (score >= 60) return "D";
return "F";
}
function hasPassingGrade(score) {
const grade = getGrade(score);
return grade !== "F";
}
function studentMsg(scores, studentScore) {
const average = getAverage(scores);
const grade = getGrade(studentScore);
const passed = hasPassingGrade(studentScore);
return `Class average: ${average.toFixed(1)}. Your grade: ${grade}. You ${passed ? "passed" : "failed"} the course.`;
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Challenge Information:
Build a Gradebook App - Build a Gradebook App