Skip to content
Advertisement

“grade” cannot be resolved to a variable

I have this exercise and the question is how can I solve the error “grade” cannot be resolved to a variable, without declare it in the class teacher. I suppose is the only error in my code. It is evident for me WHY then in my output only the grade variable is not assigned, but I don’t know HOW to solve it.

JavaScript

Advertisement

Answer

You need to assign the grade to the Student object you are passing to the assignGrade method.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement