Review JavaScript Fundamentals by Building a Gradebook App - Step 4

Tell us what’s happening:

hey good day everyone! can you help me with this one I got stuck with step # 4, and I dont know what to do!
here is the code:

Your code so far

function studentMsg(totalScores, studentScore) {
let passFail
if (hasPassingGrade(studentScore)){
  passFail=" You Passed the course."
}else {
  passFail=" You failed the course."
}
return "Class average: " + getAverage(totalScores) + ". Your grade: " + getGrade(studentScore) + "." + passFail;
}


console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37));
console.log(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100));

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

Challenge Information:

Review JavaScript Fundamentals by Building a Gradebook App - Step 4

1 Like

When you submit your code you should see the following error message:

Your function call of studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100) should return the following message: "Class average: 50.8. Your grade: A++. You passed the course." .

Check carefully what your function is returning for studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100). It is not exactly the same as the required string.

1 Like

In the if block, the letter P should be lowercase. This is the cause of the error.

if (hasPassingGrade(studentScore)){
  passFail=" You passed the course."
}