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 -

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

database - php search bar when I press submit with nothing in the search bar it shows all the data -