addEventListener

  • What just happened there?
  • Why not "myPanel.addEventListener("click", changeColor());"?
const myPanelHeader = document.querySelector(".my-panel header");
    myPanel.addEventListener("click", changeColor);
    
    function changeColor() {
        myPanelHeader.style.color = "red"
    }

3 / 21