I have created a new topic for you.
In the future, please make sure to create your own topic using the Ask for help button, and people can assist you from there
As to your issue, you have spacing issues.
You should compare the correct answer with your answer to better see the issue so you can resolve it.
Run this code here so you can see the issue for yourself
function studentMsg(totalScores, studentScore) {
if (getGrade(studentScore) !== "F") {
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));
console.log("Class average: 71.7. Your grade: F. You failed the course.")
console.log(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100))
console.log("Class average: 50.8. Your grade: A++. You passed the course.")
we can help you but you must first open your own topic by click on the Ask for help button in the challenge. Please do not post your question to someone else’s topic.
Hi,
Thanks for your notes. Noted on create new topic. The code you provided unfortunately didn’t work, but I did use the spacing issues to ask chatGPT revising it based on the issue and it worked! Post the passed code below for future reference. Thanks again!
Glad you figured it out but for future reference, please don’t post any code solutions on the forum. (But you can say what you did to fix something without posting the solution)
function studentMsg(first, second) {
if (put your condition here) {
return "can't post solution";
} else {
return "I messed up spacing and formatting before and after else";
}
}
"Class average: 50.8. Your grade: A++. You passed the course."
Your
studentMsg
function should return the correct message based on the student’s score and the class average.
// tests completed
// console output
Class average: 71.7. Your grade: F. You failed the course.
Class average: 50.8. Your grade: A++. You passed the course.
Class average: 70.25. Your grade: A. You passed the course.
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 Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.
The Ask for 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.