FAQ: Code Challenges: JavaScript Fundamentals - finalGrade()


This community-built FAQ covers the “finalGrade()” exercise from the lesson “Code Challenges: JavaScript Fundamentals”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

FAQs on the exercise finalGrade()

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!


2 posts were split to a new topic: Is there logic behind this?


2 posts were split to a new topic: The “helper” tells me that there is an error


Hi everyone.
I am doing the finalGrade() exercise. Similary, I have encountered the same error as @megacoder73951: Where the “helper” tells me that there is an error saying that 'If any of the grades passed in are less than 0 or greater than 100, the function should return ‘You have entered an invalid grade.’
Here are my codes:
// Write your function here:

const finalGrade = (num1, num2, num3) => {

const totalAmount = (num1 + num2 + num3) / 3;

if (totalAmount < 60) {

return ‘F’;

} else if (totalAmount >= 60 && totalAmount < 70) {

return ‘D’;

} else if (totalAmount >= 70 && totalAmount < 80) {

return ‘C’;

} else if (totalAmount >= 80 && totalAmount < 90) {

return ‘B’;

} else if (totalAmount >= 90 && totalAmount <= 100) {

return ‘A’;

} else {

return ‘You have entered an invalid grade.’;



console.log(finalGrade(90, 96, 92))