So, I’m doing this exercise, I write the code, I’m told it’s wrong and yet when I test it out it seems to work just fine and I used less lines of code. Did I do something wrong? Because I’m not seeing it.

The code I wrote is on top and the solution is on the bottom.

```
const finalGrade = (midterm, final, homework) =>{
const average = ((midterm+final+homework)/3)
if (average<0 || average>100){
return 'Invalid grade'
} if (average <= 59) {
return 'F';
} if (average <= 69) {
return 'D';
} if (average <= 79) {
return 'C';
} if (average <= 89) {
return 'B';
} if (average <= 100) {
return 'A';
}
}
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'
}
}
```