I can’t for the life of me get step 16 to pass. The test runner keeps saying “A” is not passing true.
Link to the project = https://www.freecodecamp.org/learn/full-stack-developer/lab-gradebook-app/build-a-gradebook-app
Any help would be appreciated.
Here is my code:
function getAverage(testScores) {
let total = 0;
if (testScores.length === 0) return "No test score provided";
return testScores.reduce((sum, score) => sum + score, 0) / testScores.length;
}
//console.log(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]));
function getGrade(studentScore) {
if (studentScore === 100) return "A+";
if (studentScore >= 90) return "A";
if (studentScore >= 80) return "B";
if (studentScore >= 70) return "C";
if (studentScore >= 60) return "D";
if (studentScore >= 0) return "F";
return "error";
}
console.log(getGrade(99));
function hasPassingGrade(score) {
return score === "A+" ||score === "A" || score === "B" || score === "C"
}
console.log(hasPassingGrade(getGrade()));
function studentMsg(scores, studentScore) {
let averageScore = getAverage(scores);
//console.log(averageScore);
let letterGrade = getGrade(studentScore);
//console.log (letterGrade);
if (["A+", "A", "B", "C"].includes(letterGrade)) {
return `Class average: ${averageScore}. Your grade: ${letterGrade}. You passed the course.`;
}
return `Class average: ${averageScore}. Your grade: ${letterGrade}. You failed the course.`;
}
//console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37))