Is there a difference between:
window.onload = someFunction;
window.onload = someFunction();
Th
window.onload = someFunction;
assigns a function to onload
.
window.onload = someFunction();
calls a function and assigns its return value to onload
. (This is not desirable unless the return value of that function is another function).
What if we Have to pass some parameter to the function
Usually you define a new function which does nothing except call the original function with some arguments, then you assign the new function to the event handler.