When we are doing inline command in the button:

```
<button id="myButton" onclick="alert('Hi!')"> 

```

Why does 

```
document.getElementById("myButton").onclick = alert('Hi!') 

```

not work but give the alert as the page is loaded? I can't understand how it works with `function()` added to it and without `function()`. I hope you guys understand my question. I'm missing something here.