function studentMsg(totalScores, studentScore) {
const average = getAverage(totalScores);
const grade = getGrade(studentScore);
const passingMessage = hasPassingGrade(studentScore) ? “You passed the course.” : “You failed the course.”;
return `Class average: ${average.toFixed(1)}. Your grade: ${grade}. ${passingMessage}`;
}
// Test case
console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37));
Tell how to solve below error happened with this,
Your studentMsg
function should return the correct message based on the student’s score and the class average.