Proyecto JS para principiantes, hice que todo funcionara, pero quería jugar con los colores. Buscando que el temporizador cambie de color cada 10 segundos. Pensé que una función básica funcionaría, pero aparentemente no. Sé que estoy haciendo algo mal en alguna parte, pero no puedo resolverlo.
window.onload = function () { let seconds = 00; let tens = 00; const roundTens = $("#tens"); const roundSeconds = $("#seconds"); const buttonStart = document.getElementById("button-start"); const buttonStop = document.getElementById("button-stop"); const buttonReset = document.getElementById("button-reset"); let Interval; buttonStart.onclick = function () { clearInterval(Interval); Interval = setInterval(startTimer, 10); }; buttonStop.onclick = function () { clearInterval(Interval); }; buttonReset.onclick = function () { clearInterval(Interval); tens = "00"; seconds = "00"; roundTens.text(tens); roundSeconds.text(seconds); }; function colorChange(color1, color2) { if (color1.value === "00" && color2.value === "59") { color1.style.color = "orange"; color2.style.color = "red"; } else if (color1.value === "00" && color2s.value === "00") { color1.style.color = "green"; color2.style.color = "blue"; } } function startTimer() { tens++; if (tens <= 9) { roundTens.text("0" + tens); } if (tens > 9) { roundTens.text(tens); } if (tens > 99) { console.log("seconds"); seconds++; roundSeconds.text("0" + seconds); tens = 0; roundTens.text("0" + tens); } if (seconds > 9) { roundSeconds.text(seconds); } } colorChange(); };startTimer debería llamar a colorChange (actualmente nunca llamado)