Review JavaScript Fundamentals by Building a Gradebook App - Step 2

Tell us what’s happening:

I don’t know what I did wrong or doing wrong. How can I fix this? Can somebody tell me how to use the if Statement in this case cause this question is different from what I learned?

Your code so far

function getAverage(scores) {
  let sum = 0;

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

  return sum / scores.length;
}

// User Editable Region

let grade;
function getGrade(score) {
  let gradeA = 99;
  let gradeB = 89;
  let gradeC = 79;
  let gradeD = 69;
  let gradeF = 59;
  
  if (score <= gradeA) {
    grade = "A " + score;
  }else if (score >= gradeA) {
    grade = "A++ " + score;
  }
  if (score <= gradeB) {
    grade = "B " + score;
  }else if (score >= gradeB) {
    grade = "B" + score;
  }
  if (score <= gradeC) {
    grade = "C " + score;
  }else if (score >= gradeC) {
    grade = "C " + score;
  }
    if (score <= gradeD) {
    grade = "D " + score;
  }else if (score >= gradeD) {
    grade = "D " + score;
  }
    if (score <= gradeF) {
    grade = "F " + score;
  }else if (score >= gradeF) {
    grade = "F " + score;
  }
}
console.log(grade);
console.log(getGrade(96));
console.log(getGrade(82));
console.log(getGrade(56));

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Agency/100.8.6097.98

Challenge Information:

Review JavaScript Fundamentals by Building a Gradebook App - Step 2

You have used so many if statements. You need one if statement and one else statement for the last. An between these two statement you need else if statement till required.
@malvo

you need to return only the grade, and you are missing the return statement completely