Review JavaScript Fundamentals by Building a Gradebook App - Step 4

function studentMsg(totalScores, studentScore) {
let pF = “”;

    if (hasPassingGrade(studentScore)) {
      pF = "You passed the course."
   }  else {
      pF = "You failed the course."       
  } 
  return "Class average:" + getAverage(totalScores) + ". Your grade:" + getGrade(studentScore) + "." + pF;

}
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)); */

Class average:71.7. Your grade:F.You failed the course.

Sorry, your code does not pass. Hang in there.

Your function call of studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37) should return the following message: "Class average: 71.7. Your grade: F. You failed the course.".

Compare what your function returns, and what it says it should return. Pay special attention to spacing, which needs to be exactly the same.

Wow, that string was soooo touchy for spacing. I finally passed after I added some spaces. Thanks for the heads up, I never would have got that!

1 Like

Glad you got it! Keep that in mind for future projects, the output spacing and formatting usually needs to be exactly the same. It helps to copy/paste any output strings given.