Review JavaScript Fundamentals by Building a Gradebook App - Step 3

Tell us what’s happening:

function hasPassingGrade(score) {
if (getGrade(score) === “F”) {
return False;
} else {
return True;
}

I am not sure as to why this code is showing an error. The code will first check the getGrade(score) if its the string “F”, if true → return false. if not → return true. So i don’t know why its not proceeding to the next step

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(score) === "F") {
    return False;
  } else {
  return True;
}


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

// 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/129.0.0.0 Safari/537.36

Challenge Information:

Review JavaScript Fundamentals by Building a Gradebook App - Step 3

javascript is case sensitive so use true and false not True and False

Thank you!!! I’ll try doing that!

1 Like


It still says that its wrong for some reason. Can I please get some help

it looks like you are missing one } to close off your function.
If you re-indent your code correctly, you can see it easily.
(and also please always indent your code before asking a question on a forum, it is just good etiquette)

function hasPassingGrade(score) {
  if (getGrade(score) === "F") {
    return False;
  } else {
    return True;
  }

Thank you very much for that! I will take note of your advise (I am new to creating the posts so I am not that knowledgeable, but I’ll try to make to it!)

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.