Hello, learning javascript.
This code is supposed to handle different functions when the window onloads.

In the code initOne, initTwo and initThree are functions.

:Questions:
Don't really see how window.onload can store functions?
It seems to be more of an event.
And if it is an event, why is it that the functions stored in the oldOnload variable are not executed the scond time the addOnLoad function is called in line 2?

Also, how can oldOnload be a conditional if it only seems to be an array of functions? ---->*if (oldOnload) {}


Code:
addOnLoad(initOne);
addOnLoad(initTwo);
addOnLoad(initThree);

function addOnLoad(newFunction){
	var oldOnload = window.onload;
	
	if(typeof oldOnload =="function"){
		window.onload = function() {
			if (oldOnload) {
				oldOnload();
				}
				newFunction();
			}
		}
		else{
			window.onload = newFunction;
			}
	}