JSFiddle - React, Tailwind, and code Playground
HTML
<h3>test</h3>
JavaScript
let h=10;
let m=0;
let s=0;
timerDisplay();
function timerDisplay() {
let time = h * 360 + m * 6 + s;
neverGiveYouUp();
setInterval(() => {
neverGiveYouUp();
}, 1000)
}
function neverGiveYouUp() {
document.querySelector('h3').innerHTML = `${h}:${m}:${s}`
if(h == 0 && m == 0 && s == 0) {
document.querySelector('h3').style.display = 'none'
}
if(m == 0 && s == 0) {
if(h > 0) {
m = 59
h--
}
}
if(s == 0) {
s = 59
m--
}
else {s--}
}