 Hello everyone hope you are all enjoying your weekend.

I am having a lot of troubles with this very simple exercise, because… I don’t know. When I run it gives me no errors, it gives me all the grades and if it’s outside of 0 or 100 it says invalid but I still get this message

Blockquote 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’

Thank you for sharing your code really helpful, could you please also share exercise url? This enables us to run your code in the lesson.

Thank you for answering me on a Saturday,

``````const finalGrade = (midterm, final, homework) => {
if ((midterm < 0 || midterm > 100) || (final < 0 || final > 100) || (homework < 0 || homework > 100)) {
return 'You have entered an invalid grade.'
}
let average = (midterm + final + homework) / 3
if (average < 60) {
return 'F'
}
else if (average < 70) {
return 'D'
}
else if (average < 80) {
return 'C'
}
else if (average < 90) {
return 'B'
} else {
return 'A'
}
}

/*
//as a function declaration:
if ((midterm < 0 || midterm > 100) || (final < 0 || final > 100) || (homework < 0 || homework > 100)) {
return 'You have entered an invalid grade.'
}
let average = (midterm + final + homework) / 3
if (average < 60) {
return 'F'
}
else if (average < 70) {
return 'D'
}
else if (average < 80) {
return 'C'
}
else if (average < 90) {
return 'B'
} else {
return 'A'
}
}
*/
``````

strings returned need to be an exact match, so copy this:

``````'You have entered an invalid grade.'
``````

from the instructions.

OMG!!! my brain was about to explode.

Thank you so so much!!

2 Likes