Почему при выполнении кода таймер не запускается, не идет отчет времени? Где то ошибка?
const timer = {
secondsPassed: 0,
minsPassed: 0,
Id: null,
startTimer() {
this.Id = setInterval(() => {
this.secondsPassed += 1;
if (this.secondsPassed === 60) {
this.minsPassed += 1;
this.secondsPassed = 0;
}
}, 1000);
},
stopTimer() {
clearInterval(this.Id);
},
getTime() {
return `${this.minsPassed}:${
this.secondsPassed < 10 ? '0' + this.secondsPassed : this.secondsPassed
}`;
},
resetTimer() {
this.minsPassed = 0;
this.secondsPassed = 0;
},
};
console.log(timer.startTimer());
console.log(timer.getTime());