Build a Gradebook App - Build a Gradebook App

Tell us what’s happening:

I don’t know how can i solve the issue in number 19, the error keep display Your hasPassingGrade function should return false if the grade is an “F”.

Your code so far

function getAverage(arr){
  let sum = 0;
  for(let i = 0; i < arr.length; i++){
    sum += arr[i];
  }
  let average = sum / arr.length;
  return average;
}
let averageScore = getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]);
console.log(averageScore);

function getGrade(studentScore) {

 return (studentScore === 100) ? "A+"

        : (studentScore >= 90) ? "A"

        : (studentScore >= 80) ? "B"

        : (studentScore >= 70) ? "C"

        : (studentScore >= 60) ? "D"

        : "F";
};
let grade =getGrade(averageScore)
console.log(grade)

function hasPassingGrade(score){
      return score !== "F";
}
let passingGrade = hasPassingGrade(getGrade(grade));
console.log(passingGrade);

 //Student message
 function studentMsg(arrayScore, studentScore){
   const average = getAverage(arrayScore);
   const grade = getGrade(studentScore);
   let passed = studentScore >= 60;

   if (passed) {
    return `Class average: ${average}. Your grade: ${grade}. You passed the course.`;
  } else {
    return `Class average: ${average}. Your grade: ${grade}. You failed the course.`;
  }
 }
 console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37));

Your browser information:

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

Challenge Information:

Build a Gradebook App - Build a Gradebook App

if it receives a score, what would that be?

notice what you are doing with scores in getGrade

and notice the part of the user stories that say

The hasPassingGrade function should use the getGrade function to get the letter grade,

1 Like

I didn’t get what you are try to say, Please can you explain it more clear than this.

What is it that you don’t understand? Try asking more specific some questions

which part is confusing you? let me know and I will explain more clearly

consider what hasPassingGrade receives when called