Last active
October 31, 2021 06:25
-
-
Save debianmaster/3507f499931917435e6fb5960687f392 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var seconds = 0; | |
var mins = 0 ; | |
var hours =0 | |
const lengthOfTime=3; | |
function updateTimer() { | |
seconds = seconds+1; | |
if(seconds>=lengthOfTime){ | |
seconds=0; | |
mins = mins+1; | |
if(mins>=lengthOfTime){ | |
hours = hours+1; | |
mins=0; | |
if(hours>=24){ | |
hours = 0; | |
mins=0; | |
seconds=0; | |
} | |
} | |
} | |
document.getElementById("seconds").innerHTML=seconds; | |
document.getElementById("minutes").innerHTML=mins; | |
document.getElementById("hours").innerHTML=hours; | |
} | |
setInterval(updateTimer,1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment