window.onload is an event called when the page has finished loading. But if I attach one function to it and then attach another function later, it overrides the first one. Example:
window.onload = function() { alert('First'); }
window.onload = function() { alert('Second'); }
Only the second alert will run.
What the code in your question does is save the first function to a variable then assigns window.onload. Now if there was anything already set on window.onload it won't run, but because we saved the variable we can run the first one.
In short, it allows us to run JavaScript after the page loads without breaking someone else's code.