It probably has to do with the 'timer' scope, but I can't get where is the problem. If anyone knows :)
function startTimer() {
let time = 0;
progress.style.width = time + '%';
let timer = function() {
setInterval(function() {
time += 0.5;
progress.style.width = time + '%';
if (time >= 100) {
clearInterval(timer);
}
}, 100);
}
timer();
}