Tell us what’s happening:
No matter what I tried test 19 keeps failing. I tried checking manually using hasPassingGrade(getGrade(18)) if method returns wrong values for some reason but no it just doesn’t work on the tests.
Your code so far
function getAverage(testScores) {
let total = 0;
for (let i = 0; i < testScores.length; i++) {
total += testScores[i];
}
return total / testScores.length;
}
function getGrade(studentScore) {
if (studentScore === 100) {
return 'A+';
} else if (studentScore >= 90) {
return 'A';
} else if (studentScore >= 80) {
return 'B';
} else if (studentScore >= 70) {
return 'C';
} else if (studentScore >= 60) {
return 'D';
} else {
return 'F';
}
}
function hasPassingGrade(score) {
return score === 'F' ? false : true;
}
function studentMsg(scoresArray, studentScore) {
const averageScore = getAverage(scoresArray);
const grade = getGrade(studentScore);
const passing = hasPassingGrade(grade);
if (passing) {
return `Class average: ${averageScore}. Your grade: ${grade}. You passed the course.`;
} else {
return `Class average: ${averageScore}. Your grade: ${grade}. You failed the course.`;
}
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0
Challenge Information:
Build a Gradebook App - Build a Gradebook App