Review js fundamentals by building a gradebook app - Step 4

function studentMsg(totalScores, studentScore) {
const classAverage = getAverage(totalScores);
const studentGrade = getGrade(studentScore);

if (studentGrade != "F")
{ return ("Class average: "+ classAverage.toFixed(1)+ ". Your grade: " + studentGrade+ ". You passed the course.");
 
} else {
   return ("Class average: "+ classAverage.toFixed(1) +". Your grade: " + studentGrade + ". You failed the course.");
}
}
console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37));
console.log(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100));
```[quote="super_Blessings, post:1, topic:722429, full:true"]

function studentMsg(totalScores, studentScore) {
const classAverage = getAverage(totalScores);
const studentGrade = getGrade(studentScore);

if (studentGrade != “F”)
{ return ("Class average: "+ classAverage.toFixed(1)+ ". Your grade: " + studentGrade+ “. You passed the course.”);

} else {
return ("Class average: “+ classAverage.toFixed(1) +”. Your grade: " + studentGrade + “. You failed the course.”);
}
}
console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37));
console.log(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100));

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

Hi @JeremyLT

Try removing the rounding.

For next time, describe the issue in your own words. Learning to communicate problems is a part of becoming a web developer.

Happy coding

am keeping getting this error : Your studentMsg function should return the correct message based on the student’s score and the class average. how can i fix it?

Did you remove the following method?:

1 Like

Thanks @Teller it worked finally, sorry for the way i posted the question. i have been trying it even CHATGPT could not help.

1 Like

I would ask real humans here instead of ChatGPT.

1 Like