I have 1 counter. The counter will count down from 25 first. It will then start counting down from 10 when this time is up. When this time is over, it will start counting down from 25 again. That's how it will go. How can I do it?
var interval10 = 10000;
var interval = 25000;
function tensecond() {
var remaining = interval10 - (Date.now() % interval10);
}
setInterval(function () {
if (remaining >= 100) {
document.getElementById("timer").innerText =
millisToMinutesAndSeconds(remaining);
} else {
reset();
}
}, 100);
function reset() {
var remaining = interval - (Date.now() % interval);
}
setInterval(function () {
if (remaining >= 100) {
document.getElementById("timer").innerText =
millisToMinutesAndSeconds(remaining);
} else {
tensecond();
}
}, 100);
function millisToMinutesAndSeconds(millis) {
var seconds = Math.floor((millis % 60000) / 1000);
return (seconds < 10 ? "0" : "") + seconds;
}