Hi, congratulation for solving the level!
Your code seems to be just right! (some formattiong issues with the bold thoug, but it's clear what you wrote!)
In contrast to that there was an error in the picture you posted:
In the function mod40(n), the
else branch ist missing, so that there is no value returned whenever
n < 40. The function would thus return NaN (not an number) when finnished. This would result in the error message that you have shown.
NB. I'm not sure about the rules here, but I think that complete solution should not be posted in order not to spoil it for others...
Not sure what you meant with "you don't need to change the following code' part was wrong!". You did not change the code after the line with that text