Difference between calling function and referencing function?

BursegydayBed

New Member
Look at the following code:\[code\]window.onload = someFunction;\[/code\]Many times I see the use of this kind of code and even I use the same. But, there are still few things unclear. [*]The above is a call to \[code\]someFunction\[/code\] as soon as the page loads, right. But, aren't we supposed to call a function with brackets \[code\]()\[/code\]?[*]From my understanding, we are just assigning \[code\]someFunction\[/code\] to \[code\]window.onload\[/code\], therefore can we or shouldn't we call \[code\]window.onload()\[/code\];[*]Are there such cases, when \[code\]functionName()\[/code\] and \[code\]functionName\[/code\] becames interchangeable. Because at many places, and in various API, I have seen calling the function without brackets.
 
Top