This is an example of click button to pop up an alert.
Fact is that, only html elements will be rendered quickly & shown to you before performing script operation, and it looks like page is loading faster,
also javascript is interpreted not compiled by design, so it will be executed line-by-line, so if you are asking for some jquery function and they are not interpreted already then browser will throw error, that's why we need to add jquery in first line.
try running
HTML Element
vs
HTML Element
OR have a look on this first
Script executed at top
and then
Script executed at last
it will clear your concept.
also for your reference please have a look on this