const h1 = document.querySelector("h1"); function updateClock() { const time = new Date(); h1.textContent = time.toLocaleTimeString(); } setInterval(updateClock, 1000);