I need help debugging this code | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 4

I need help debugging this code

This code returns an error on line 29 but Iā€™ve failed to rectify it. All kinds of help is highly appreciated šŸ™šŸ½ Thank you šŸ˜Š https://code.sololearn.com/Wj0M4WHqEeyG/?ref=app

14th Sep 2023, 5:35 AM
Izaiah Kay
Izaiah Kay - avatar
6 Respostas
+ 4
You have to surround your complete JavaScript with window.onload = function(){ /* here comes your code */ } This ensures that your JavaScript waits to start until the whole HTML code is loaded which is done by the onload-event. The error is caused by the fact that the JavaScript runs before the HTML is loaded completely, and that's the reason why some elements, which you refer to in the JavaScript, are not present yet. improved code: https://code.sololearn.com/W1LRFyOMVVkr/?ref=app
14th Sep 2023, 6:11 AM
Jan Markus
+ 5
Jan Markus thank you so much šŸ¤šŸ½
14th Sep 2023, 6:12 AM
Izaiah Kay
Izaiah Kay - avatar
+ 4
Izaiah Kay You are welcome! šŸ™‚šŸ‘
14th Sep 2023, 6:39 AM
Jan Markus
+ 3
Izaiah Kay Now I have also improved the code that the score is adapted during the quiz. Only at the last question there has to be inserted a delay before proceeding to the evaluation.
14th Sep 2023, 7:58 AM
Jan Markus
+ 2
Thank you so much Jan Markus Hereā€™s the debugged code. With credits to you https://code.sololearn.com/Wj0M4WHqEeyG/?ref=app
14th Sep 2023, 7:44 AM
Izaiah Kay
Izaiah Kay - avatar
+ 2
Jan Markus Thats very cool
14th Sep 2023, 8:12 AM
Izaiah Kay
Izaiah Kay - avatar