Is there a way to do functions and variable hoisting between source code present in different files? That is, something like
//Inside firstfile.js
foo === \"bar\
All script tags that browser encounters are parsed and executed immediately. This is because of document.write API, that might require to browser to output something to the DOM. This means that in this situation #script1's has to finish before #script2.
You might want to check what the behaviour when using ASYNC and DEFER attributes. They are supported in Webkit.