hello everyone i'm working on a clock timer i wrote the code in angular code it work very fine
let timer: string = "0:00:00"; startPause() { this.play = false; this.pause = true; let sec = 0; let min = 0; let hour = 0; setInterval(() => { if(sec === 59) { min++; sec = 0; } else if(min > 59) { hour++; min = 0; } else { sec++; } this.timer = `${hour}:${min}:${sec}`; }, 10); } the output is correct but when i want to add zero before seconds or minutes or hours if they are < 10 i write this sec = "0" + sec it tells me the String Type Is Not assignable to sec thank u.
${pad(hour)}:${pad(min)}...etc.)