Jesse DispotoFront End Web Development Techdegree Graduate 14,280 Points
Why is the prompt loading before the html on the page loads?
The source.js file is placed on the bottom of the html document. Why is the prompt displaying before the page loads? Shouldn't it prompt after the page loads, according to the order in the html?
"The web browser looks at the entire HTML document"
It would seem that a browser looks at the entirety of the document and elements before loading. so when the prompt command comes it gets stuck and has to collect it first. if you want it to wait you would need to make it only prompt after the page is loaded... there are a few ways on the internet
Ismayil Aliyev18,529 Points
It also depends on the browser. On Edge it also shows the HTML code while running Prompt and Alert whereas on Chrome HTML is seen only after the execution of the JS.