Review JavaScript Fundamentals by Building a Gradebook App - Step 4

Hi there,
I’ve been stuck on this step for over a week, and can’t figure it out, please help!
The code seems to print the correct string of text, but I keep getting this message:
“Your studentMsg function should return the correct message based on the student’s score and the class average.”

function getAverage(scores) {
  const sum = scores.reduce((total, score) => total + score, 0);
  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";
}

function studentMsg(totalScores, studentScore) {
  const classAverage = getAverage(totalScores);
  const studentGrade = getGrade(studentScore);
  const passed = studentGrade !== "F";

  return (
    "Class average: " + classAverage.toFixed(1) +
    ". Your grade: " + studentGrade +
    ". You " + (passed ? "passed" : "failed") + " the course."
  );
}

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));

Where you asked to round the value?

Ah, I see it now! Thanks :slight_smile: