+ 5
Within SoloLearn, I have been putting all my JavaScript on the 'JS' tab in code playground. I then have this:
window.onload = function(){
// script goes here
}
The above approach makes it a lot easier to maintain both your HTML and JavaScript as you keep them separate. The window.onload will wait for the HTML to load before running the script.