Review Javascript Fundamentals by Building a Gradebook App - Step 4

Hi everyone, i have an issue in this step. I feel like i am missing something because my code does not pass. This is what i have:

function getAverage(scores) {
  let sum = 0;

  for (const score of scores) {
    sum += score;
  }

  return sum / scores.length;
}

function getGrade(score) {
  if (score === 100) {
    return "A++";
  } else if (score >= 90) {
    return "A";
  } else if (score >= 80) {
    return "B";
  } else if (score >= 70) {
    return "C";
  } else if (score >= 60) {
    return "D";
  } else {
    return "F";
  }
}

function hasPassingGrade(score) {
  return getGrade(score) !== "F";
}


// User editable region
function studentMsg(totalScores, studentScore) {
   if(hasPassingGrade(studentScore))
   {
   return ("Class Average: " + getAverage(totalScores) + ". Your grade:" + getGrade(studentScore) + ". You passed the course.");
   }
   else
   {
   return ("Class Average: " + getAverage(totalScores) + ". Your grade: " + getGrade(studentScore) + ". You failed the course.");
   }
}
console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37));

the output i see is this:

// running tests 1. 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."

. 2. 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."

. 3. Your

studentMsg

function should return the correct message based on the student’s score and the class average. // tests completed // console output Class Average: 71.7. Your grade: F. You failed the course.

also i would want to apologise if this question has already been answered. Thanks a lot for your time!

Please always include the link to the step

Let’s do some debugging:
So, the first failing step is:

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." .

So we can add

console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37));
console.log("Class average: 71.7. Your grade: F. You failed the course.");

The outputs we get are:

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

They are quite similar, but there is a difference, can you see it?

thank you for the reply. can you tell me how i can include the link to the step? also yeah i saw what you mean(feel kinda dumb after noticing it better). but i fixed it. could you help me with the remaining issues?

If you use the Help button it is included automatically

what remaining issues? why don’t you try to debug the issues yourself?

i am sorry for the late reply. but yes the code run good now, thank you again