document.querySelectorAll(".item").forEach((el) => { el.addEventListener("click", (event) => { document.body.style.backgroundColor = getComputedStyle( event.target ).backgroundColor; }); });