On the window.onload event, I would like a function to be called. If I define it as given below, the function does not get called.
try {
window.addEventListener("load", initialiseTable, false);
} catch(e) {
window.onload = initialiseTable;
}
var initialiseTable = function () {
console.log("hello world!!");
};
but if I change the function declaration to
function initialiseTable() {
console.log("hello world!!");};
it works, any idea?