Build a Gradebook App - Build a Gradebook App

Tell us what’s happening:

I can’t pass #19. I’m confused. My code will return true/ false depending on the average score

Your code so far


const scores = [100, 59, 1, 0, 20, 100, 100, 100]

function getAverage(arr){

  let averageScore = 0

  for(let i=0; i < arr.length; i++){

    averageScore += arr[i] 
  }

  return +(averageScore/arr.length).toFixed(3)
}
console.log(getAverage(scores))


function getGrade(studScore){

  let letterGrade = ''

  letterGrade = 
  studScore >= 0 && studScore < 60 ? "F" 
  : studScore < 70 ? 'D'
  : studScore < 80 ? 'C'
  : studScore < 90 ? 'B'
  : studScore < 100 ? 'A'
  : 'A+'

  return letterGrade
}

function hasPassingGrade(score){

  let boolean = false

  if(score !== 'F'){
    return !boolean
  }

  return boolean
}

console.log(getGrade(getAverage(scores)))

console.log(hasPassingGrade(getGrade(getAverage(scores))))

Your browser information:

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

Challenge Information:

Build a Gradebook App - Build a Gradebook App

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-gradebook-app/66bb6a9c2dd58b73cd759034.md at main · freeCodeCamp/freeCodeCamp · GitHub

Hi @navarro.30stars

  1. 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 score parameter is a number not a letter.

Happy coding