index.html
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script src="Script1.js"></script>
    <script src="Script2.js"></script>
</head>
<body>
</body>
</html>
Script1.js
var Main;
window.onload = Main;
Script2.js
function Main() {
    alert("foo");
}
If I throw a breakpoint @ var Main; and step through the code in WebStorm, it appears to:
- Load Script1.js.
- Load Script2.js.
- Call Main().
However it doesn't execute the statement alert("foo") in that function.  Could someone explain what's going on in more detail?
- NOTE: I realize you should avoid using onload.
- NOTE: I realize I could re-order the scripts and it would show the alert.
- NOTE: If I omit the statement var Main;, step 3 above does not occur.
Bonus:  In WebStorm, it shows the value of the window.onload field as null and the value of Main as void.  What is the difference between a value of null and void?
 
     
     
    