const title = document.querySelector("#title");
const CLICKED_CLASS = "clicked";
function handleClick() {
title.classList.toggle(CLICKED_CLASS);
//안타깝게도 이 밑은 toggle 하나로 퉁쳐질 수 있다
/*
const hasClass = title.classList.contains(CLICKED_CLASS); //hasClass는 true, flase로 값이 나온다
if(hasClass) {
title.classList.remove(CLICKED_CLASS);
} else {
title.classList.add(CLICKED_CLASS);;
}
*/
}
function init() {
title.addEventListener("click", handleClick);
}
init();