I’m not sure where I’ve made the mistake in my code , although the function is returning grades its also returning Undefined. Any help appreciated
function getAverage(scores) {
let sum = 0;
for (const score of scores) {
sum += score;
}
return sum / scores.length;
}
// User Editable region
function getGrade(score) {
if (score === 100){
console.log("A++");
} else if (score <= 99 && score >= 90){
console.log("A");
} else if (score <= 89 && score >= 80){
console.log("B");
} else if (score <= 79 && score >= 70){
console.log("C");
} else if (score <= 69 && score >= 60){
console.log("D");
} else {
console.log("F");
}
return console.log(score)
}
console.log(getGrade(96));
console.log(getGrade(82));
console.log(getGrade(56));
// User editable region ends