Tell us what’s happening:
the code which i wrote is showing error in test while score is 78 but i have created a log with function getGrade(78) in online compiler then it came fine without error. it showing error in this compiler because i did something wrong or is there anything else ?
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) {
let grade;
if(score===100){
grade = "A++" ;
}
else if(score >= 90 && score <= 99){
grade = "A";
}
else if(score >= 80 && score <= 89){
grade = "B";
}
else if(score > 71 && score < 80){
grade = "c";
}
else if(score >= 60 && score <= 69){
grade = "D";
}
else{
grade = "F";
}
return grade;
}
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/126.0.0.0 Safari/537.36 Edg/126.0.0.0
Challenge Information:
Review JavaScript Fundamentals by Building a Gradebook App - Step 2