Build a Gradebook App - Build a Gradebook App

Tell us what’s happening:

What’s could i do to pass the step 17? I don’t know what to do

Your code so far

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

function getGrade(score) {
  return score == 100 ? "A+" : 
  score >= 90 && score <= 99 ? "A" :
  score >= 80 && score <= 89 ? "B" :
  score >= 70 && score <= 79 ? "C" :
  score >= 60 && score <= 69 ? "D" :
  score >= 0 && score <= 59 ? "F" : ""
}

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

function studentMsg(arr, score) {
  return `Class average: ${getAverage(arr)}. Your grade: ${getGrade(score)}. You ${hasPassingGrade(getGrade(score)) ? "passed" : "failed"} the course.`

}

console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 7))

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:139.0) Gecko/20100101 Firefox/139.0

Challenge Information:

Build a Gradebook App - Build a Gradebook App

You should have a function named hasPassingGrade that takes a score as a parameter and returns either true or false depending on if the score corresponds to a passing grade.

The hasPassingGrade function should use the getGrade function to get the letter grade, and use it to determine if the grade is passing. A passing grade is anything different from "F".

Please carefully re-read these user stories again and check to see if your code is doing what was asked.

What is test 17? What have you tried to figure out what is wrong? Where did you get stuck debugging?