0

Can someone fix this please? You will get credits

Hello. So in I made a snake game just for fun, then once it's all finished, there was an error, two in fact and I just cannot fix this. So if anyone knows the fix, leave a comment and I will credit you in the game! https://code.sololearn.com/WaINGwF5fLh4/?ref=app

19th Oct 2022, 4:32 AM
RayZ
RayZ - avatar
6 ответов
+ 1
yes In the sololearn app as Ausgrindtube mention. window.onload = () => { //all your code here :D }
19th Oct 2022, 8:18 AM
arturop200
arturop200 - avatar
+ 3
I read that Sololearn loads the JavaScript tab first, so you need to wrap your code in a window.onload. probably from line 1...?
19th Oct 2022, 5:24 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Nice job. And what are the errors? At the moment all I see is that score is not being reset when you hit play again, page needs to be reloaded.
19th Oct 2022, 5:14 AM
arturop200
arturop200 - avatar
0
Arturop it's the "uncought typeError" error that I'm talking about So did I misspelled it, if so what is the correct way? or else, maybe my phone can't handle it
19th Oct 2022, 7:18 AM
RayZ
RayZ - avatar
0
Thanks!
19th Oct 2022, 9:04 AM
RayZ
RayZ - avatar