You used different quote marks within the condition and returning strings. Keep the straight double quote " marks replace the curly ones with the straight double quote" mark.
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.
Post your code here within the pair of three back ticks (```). Back ticks should be on a separate line before and after your code. Also include link to the challenge step after your last three back ticks
The console is throwing an error on above parameters initialization. It’s already been declared as the function () parameters above, so you didn’t need to use let keyword.
You need only else block after if block. And the condition is not required for else block. Also fix the spacing and punctuation within the returning strings also. The output should be exactly as the test required it. Then your code will pass.
Post your updated code here in your next reply. Add three back ticks or use </> preformatted text option in reply settings to insert back ticks automatically. Place your code between the back ticks. Back ticks should be on a separate line before and after your code.
Can u please help me This error is showing :
Your studentMsg function should return the correct message based on the student’s score and the class average.
function studentMsg(totalScores, studentScore) {
const average = getAverage(totalScores);
const grade = getGrade(studentScore);
if(grade !== “F”){
return "Class average: " + average.toFixed(1) + ". Your grade: " + grade + “. You passed the course.”;
}
else{
return "Class average: " + average.toFixed(1) + ". Your grade: " + grade + “. You failed the course.”;
}
}
console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37));