Build a Gradebook App - Build a Gradebook App

Tell us what’s happening:

I think there’s a bug, it won’t verify hasPassingGrade Function task.
the function return “false” if the grade is “F”, i did the code but it wont verify

Your code so far

function getAverage(scoreArray) {
  let sum = 0 
 for (let number of scoreArray) {
   sum += number
 }
 return sum / scoreArray.length
}

function getGrade(studentScore) {
  let grade;
  switch(true) {
    case studentScore == 100:
      grade = "A+";
      break;
    case studentScore >= 90:
      grade = "A";
      break;
    case studentScore >= 80:
      grade = "B";
      break;
    case studentScore >= 70:
      grade = "C";
      break;
    case studentScore >= 60:
      grade = "D";
      break; 
    default:
      grade = "F";
  }
  return grade
}

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

console.log(hasPassingGrade(getGrade()))

function studentMsg(arrayScore, studentScore) {
 let averageFunc = getAverage(arrayScore)
 let studentGrade = getGrade(studentScore)
 let isPassingGrade = hasPassingGrade(studentGrade)  

  if (!isPassingGrade) {
    return `Class average: ${averageFunc}. Your grade: ${studentGrade}. You failed the course.`
  } else {
    return `Class average: ${averageFunc}. Your grade: ${studentGrade}. You passed 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/143.0.0.0 Safari/537.36

Challenge Information:

Build a Gradebook App - Build a Gradebook App

Welcome to the forum @hazzeldhanniswaram

  1. The hasPassingGrade function should use the getGrade function …

Are you sure you are fulfilling user story 4?

Happy coding

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