Review JavaScript Fundamentals by Building a Gradebook App - Step 3

Tell us what’s happening:

Ok I don’t really understand what’s going on, the instruction say to return true if it’s not “F” and false if it’s “F”. What I’m I doing wrong?

Your code so far

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";
  }
}


// User Editable Region

function hasPassingGrade(score) {
  if(getGrade = "A") {
    return true;
  } else if(getGrade = "F") {
    return false;
  }
}


console.log(hasPassingGrade(100));
console.log(hasPassingGrade(53));
console.log(hasPassingGrade(87));

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Mobile Safari/537.36

Challenge Information:

Review JavaScript Fundamentals by Building a Gradebook App - Step 3

Hi @Zionmusa

Take a close look at the conditions of the if and else if conditions.

Happy coding

Hi. I’m sorry but I don’t really understand or see any issue with my code. I know I’m missing something but I don’t know what that is exactly. Thank you for your time

Compare the syntax of the conditions in the hasPassingGrade function to the getGrade function.

Sorry sir I really don’t understand what you mean

I removed the getGrade from the condition but it’s not passing. I did
If getGrade(A) {
return true;
} else if getGrade(F) {
return false;
}

My code passed. Thanks for the help

1 Like