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