Call it planning ahead...
The code is preparing for the load completion by assigning a function that will execute after the load completion event occurs--the function does not execute just because it appears first. If you prepare for an event after the activity that leads up to the event has already begun, you run the risk of not being ready when the event occurs... the file could load before the function exists and the actions of that function would not be executed as a result.
Try to think of it in terms of planning ahead. like for a surprise party. You tell everyone to wait until the victim arrives and turns on the lights before everyone yells "surprise!!". You have prepared them to take an action when the event finally occurs. If you had tried to tell them the plan when the person was already reaching for the lights......
Hi Ned Murphy,
Thanks for the explanation. I appreciate it.