const pauseButton = document.querySelector(".pause-button"); const animationElement = document.querySelector(".animate-progress"); pauseButton.addEventListener("click", () => { if ( animationElement.style.animationPlayState === "running" || animationElement.style.animationPlayState === "" ) { animationElement.style.animationPlayState = "paused"; // ... existing code ... } else { animationElement.style.animationPlayState = "running"; // ... existing code ... } });