Tell us what’s happening:
in the console the function sends me the rigth value but on the tests it shows up as wrong
Your code so far
function getAverage (array){
let avg=0;
for(let testScore of array){
avg+=testScore
}
return avg/array.length
}
function getGrade (studentScore){
if(studentScore==100){
return "A+"
}else if(90<=studentScore){
return "A"
}else if(80<=studentScore){
return "B"
}else if(70<=studentScore){
return "C"
}else if(60<=studentScore){
return "D"
}else{
return "F"
}
}
function hasPassingGrade (studentScore){
return studentScore!=="F"?true:false
}
function studentMsg(arrayOfScores,studentScore){
let avg=getAverage(arrayOfScores)
let hasPassed=hasPassingGrade(getGrade(studentScore))
if(hasPassed){
return `Class average: ${avg}. Your grade: ${getGrade}. You passed the course.`
}else{`Class average: ${avg}. Your grade: ${getGrade}. You failed the course.`}
}
console.log(hasPassingGrade("F"))
console.log(typeof hasPassingGrade("F"))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Challenge Information:
Build a Gradebook App - Build a Gradebook App
https://www.freecodecamp.org/learn/full-stack-developer/lab-gradebook-app/build-a-gradebook-app
