Please I don’t understand why my code isn’t passing.. I have tried even using string concatenation to get it but still not passing.. I need help
Your code so far
function getAverage(scores) {
let sum = 0;
for (const score of scores) {
sum += score;
}
return sum / scores.length;
}
function getGrade(score) {
if (score === 100) {
return "A++";
} else if (score >= 90) {
return "A";
} else if (score >= 80) {
return "B";
} else if (score >= 70) {
return "C";
} else if (score >= 60) {
return "D";
} else {
return "F";
}
}
function hasPassingGrade(score) {
return getGrade(score) !== "F";
}
// User Editable Region
function studentMsg(totalScores, studentScore) {
if (hasPassingGrade ) {
return "Class average:" + getAverage(totalScores) + "Your grade:" + getGrade(studentScore) + "you passed the course";
}
else {
return "Class average:" + getAverage(totalScores) + "Your grade:"+ getGrade(studentScore) + "you failed the course";
}
}
console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37));
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Linux; U; Android 12; en-ng; CPH2387 Build/SP1A.210812.016) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.98 Mobile Safari/537.36 PHX/16.8
Challenge Information:
Review JavaScript Fundamentals by Building a Gradebook App - Step 4
Sorry for late response.. although I don’t really understand what you mean.. by what you showed me , I need my concatenation to be done properly right.. and what I found out with the console you showed me.. 71.1 showed the student got an F which is wrong.. so I would try a different stuff then come show you.. thanks
Well I looked at it.. it seems I got it but the one problem I’m facing right now is the semicolon at the end of the sentence.. I can’t seem to get it right.. maybe I don’t know how to add the semicolon there
If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Help button located on the challenge. This button only appears if you have tried to submit an answer at least three times.
The Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.