0

Can anybody help me with my code?

Hello :) I am new to JavaScript. I made a little game in a tutorial. On my desktop it runs without errors. In Sololearn it says: "Uncaught TypeError: Cannot read property 'appendChild' of null Line: 19". https://code.sololearn.com/W52aUO0LEzWn Can anybody help me and give me a hint? Thank you! Regards, Steffen

28th Sep 2020, 12:11 PM
Steffen Rust
Steffen Rust - avatar
2 Respostas
+ 3
Hi,place that code in window.onload=function(){ Js code goes here } sololearn places script inside head tag ,so selecting an element before the dom loads fully raises that error
28th Sep 2020, 12:28 PM
Abhay
Abhay - avatar
+ 1
You are awesome, thank you so much!
28th Sep 2020, 1:21 PM
Steffen Rust
Steffen Rust - avatar