Tell us what’s happening:
Feel like I’m bashing my head through a wall here. I’m getting the correct grades back, but also with score itself and ‘undefined’
Your code so far
function getAverage(scores) {
let sum = 0;
for (const score of scores) {
sum += score;
}
return sum / scores.length;
}
// User Editable Region
function getGrade(score) {
{
const grade= score;{
if (grade === 100)
console.log("A++");
}
if (grade <= 99 && grade >= 90) {
console.log("A")
}
else if (grade <= 89 && grade >=80) {
console.log("B");
}
else if (grade <= 79 && grade >= 70){
console.log("C");
}
else if (grade <= 69 && grade >= 60){
console.log("D");
}
else if (grade <= 59){
console.log("F");
}}
return score;
}
console.log(getGrade(96));
console.log(getGrade(82));
console.log(getGrade(56));
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Challenge Information:
Review JavaScript Fundamentals by Building a Gradebook App - Step 2