What is the purpose of onload function used with document and window?
Also why is console.log(); hi2 logging before hi?
wondow.onload is used to execute certain code on page load. If you have anything that you want the page to do or behave in a certain way when it loads , that code should go there.
But here you are missing a closing brace for the onload function. That could be a problem.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.