+ 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 Antworten
+ 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