When I want to execute a script myFunction(){} when a page is loaded I have two choices.
1 <body onload="myFunction()">
2 <script> window.onload = myFunction </script>
My question is why we need parentheses in the first case but not in the second case? What is the theory behind it?