loading of functions in javascript -



loading of functions in javascript -

i new javascript, started learning few days ago. learning functions , of tutorials reading said functions should set in script tag in head tag can loaded first. mean ? because wrote code

<!doctype html> <html> <body> <p id="demo"></p> <script> function1(); function function1 () { document.getelementbyid("demo").innerhtml="hey"; } </script> </body> </html>

and code works. thing don't understand how. how can phone call function hasn't been "loaded" yet? browser read script tag in different way rest of html document? can explain how work ?

the script tag whole block. funtion1() called after whole script tag loaded.

javascript

Comments

Popular posts from this blog

php - How to pass multiple values from url -

php - Laravel not returning controller -

c# - Confused on how to specify a Platform and Version while using ChromeOptions for RemoteWebDriver with Selenium donNet since recent updates -