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
Post a Comment