title: How does setInterval() work with button.onclick
body: <p>I want the alertMe function to be called only when the button is clicked, but it gets called (the setInterval gets called which calls that) AS SOON AS THE PAGE LOADS. But if I take the pageLoad function away, then startButton is null and I can't do anything with it.Thanks in advance, guys!</p>
  
  <pre><code>/when user clicks start, start the animation
  window.onload = pageLoad;
  
  function pageLoad() {
      var startButton = document.getElementById("start");
  
      startButton.onclick = setInterval(alertMe,200);
  }
  
  function alertMe() {
    alert("hi");
  }
  </code></pre>