Review JavaScript Fundamentals by Building a Gradebook App - Step 3

Tell us what’s happening:

What am I getting wrong :thinking:??? Because I feel like it’s the ryt code but it won’t pass

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) {
  const grade =getGrade;
  if(grade!=="F"){
    return true;
  }else if(grade==="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/127.0.0.0 Safari/537.36

Challenge Information:

Review JavaScript Fundamentals by Building a Gradebook App - Step 3

This line is the issue. You’re trying to assign a function call to a variable but you’re not actually calling the function or supplying an argument to it.

Also, as you’re looking to return a truthy/falsy value, you don’t need such involved logic in your function. You don’t even need the grade variable either. You could directly return the function call to getGrade.

Here’s an illustrative example of a function which returns a truthy/falsy value depending on the argument which is supplied to the colour parameter:

function isYourFavouriteColourRed(colour) {
  return colour == "red";
}

isYourFavouriteColourRed("blue") // returns false
isYourFavouriteColourRed("red") // returns true
1 Like