Review JavaScript Fundamentals by Building a Gradebook App - Step 3

Tell us what’s happening:

I need guide here.
function hasPassingGrade(score) {
for (let i = 0;i > score;i++){
return true;
}
return false;
}

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) {
  for (let i = 0;i > score;i++){
    return true;
  }
    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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0

Challenge Information:

Review JavaScript Fundamentals by Building a Gradebook App - Step 3

hi there!
you need an if…else statment for this challange.

Read the instructions again start by returning the function getGrade() with scores as the param. just calling it in a way. Remove the for loop true and false arnt needed either they want a booleen assignment then the letter.

or you can return score if grade is more then or equal to passing marks. and that is the simple one line code.
@enyereibechibueze

I have tried it, it kept saying result should be a boolean

what is your code now?

always post your code here, using three back ticks in seperate line above and below your code block. when you till not found the solution.
@enyereibechibueze

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

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

what is hasPassingGrade here?

notice that you have only score available, and with that you determine if it’s enough to pass or not