Digital clock

Hello! I'm trying to create a digital clock but there are a few issues in it

• the first one is that the seconds kept going from 1 to infinity to stop that i have put a condition to stop the seconds at 60 but after 60 they aren't starting from 1 when the page refreshes than it happens

• also the minutes are not updating when 60sec are completing
e.g: at 10:28:60 the minutes should be updated to 29 and seconds should start from 1 all this happens when page refreshes

let intervalId = setInterval(() => {
         // console.log(seconds++);
         timePara.innerHTML= `${hours}   :   ${minutes}   :     ${seconds++}   `;
         if (seconds === 61){
                     clearInterval(intervalId);
                 }
     }, 1000);
 }


here is the link to code https://github.com/Myragull/Digital-Clock


and live at
https://myragull.github.io/Digital-Clock/
GitHub
Contribute to Myragull/Digital-Clock development by creating an account on GitHub.
Was this page helpful?