really? the word score is already in the template i did not add that!
here’s the error: // running tests 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.
My Code:
function studentMsg(totalScores, studentScore) {
const average = getAverage(totalScores);
const grade = getGrade(studentScore);
if (hasPassingGrade(studentScore)) {
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));
Now that the teacher has all of the information they need, they want to be able to message the student with the results.
Complete the studentMsg function with totalScores and studentScore for parameters. The function should return a string representing a message to the student.
If the student passed the course, the string should follow this format:
Class average: average-goes-here. Your grade: grade-goes-here. You passed the course.
If the student failed the course, the string should follow this format:
Class average: average-goes-here. Your grade: grade-goes-here. You failed the course.
Replace average-goes-here with the average of the total scores. Replace grade-goes-here with the student’s grade.
Tips
Use the getAverage function to get the class average.
Use the getGrade function to get the student’s grade.
Use string concatenation (+) to build the message.
Be careful with the punctuation and spaces in the message.
I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
thanks i just happened to remove .toFixed to test if it is working or now but somehow it works. i didnt mean ur wrong its just compiler showing error with correct output. by the way thank u