const h2 = document.querySelector("h2");
const superEventHandler = {};
function mouseEnter() {
  h2.style.color = colors[0];
  h2.innerText = "The mouse is here!";
}

function mouseLeave() {
  h2.style.color = colors[1];
  h2.innerText = "The mouse is gone!";
}

 

위에 내용을 도대체 어떻게 넣나 했는데 이렇게 넣는 거 였다..

다음에 또 까먹으면 보러와야지

const h2 = document.querySelector("h2");
const superEventHandler = {
  handleEnter:function(){
    h2.style.color = colors[0];
    h2.innerText = "The mouse is here!";
  },
  handleLeave:function(){
    h2.style.color = colors[1];
    h2.innerText = "The mouse is gone!";
  }
};

h2.addEventListener("mouseenter", superEventHandler.handleEnter);

+ Recent posts