Yngvarr

Generation

generate functionTue, 14 Feb 2023

time online

var hh = 0; var mm = 0; var ss = 0; var start = false; var timerInterval = null; function startTimer() { if (start === false) { start = true; timerInterval = setInterval(function() { ss++; if (ss === 60) { mm++; ss = 0; } if (mm === 60) { hh++; mm = 0; } var newTime = (hh < 10 ? '0' + hh : hh) + ':' + (mm < 10 ? '0' + mm : mm) + ':' + (ss < 10 ? '0' + ss : ss); document.querySelector('.timer').innerHTML = newTime; }, 1000); } } function stopTimer() { if (start === true) { start = false; clearInterval(timerInterval); } } function resetTimer() { stopTimer(); hh

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant