This is not the correct approach. Also, getAverage() takes a parameter. Normally, in a conditional, two values are compared but here you are assigning totalScores to getAverage().
Your studentMsg() function should return the message given in the instructions, only it should be dynamic, so that “average-goes-here” and “grade-goes-here” are replaced with the results of calling getAverage() and getGrade(), respectively.
Use the getAverage function to get the class average.
Use the getGrade function to get the student’s grade.
function studentMsg(totalScores, studentScore) {
return “Class average: 71.7. Your grade: F. You failed the course.”
return “Class average: 58.8. Your grade: A++. You passed the course.”;
}
console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37));
It looks like you have hard-coded conditionals or variables that check for specific expected values. That is not solving this problem in the general case. Imagine if you were given different input values. Would your code be able to solve those problems?
To find out more about what hard-coding is or about why it is not suitable for solving coding questions, please read this post: Hard-coding For Beginners
Let us know if you have a question about how to make your code more flexible.
What is it about this instruction you do not understand? Do you know how to call a function? Do you know how to concatenate a string that includes the value of variables?
thank you, i applied a different approach from your explanation and was able to use the getAverage() but the second part is still not working. please i would appreciate assistance with the next approach.