How to do clearing cache in js?

The question is, I have code that somehow always works when you clear the cache, that is, in the browser, reload using Ctrl + F5. But just when you go to the page or portaguese only F5 helps
window.onload = function(){
 function timer(){
 let minute = document.getElementById("m").innerHTML + document.getElementById("mm").innerHTML;
 let second = document.getElementById("s").innerHTML + document.getElementById("ss").innerHTML;
 let end = false;

 if(second > 0) second--;
 else {
 second = 59;
 if( minute > 0) minute--;
 else {
 end = true;
}
}
if(end){
clearInterval(intervalID);
$('#modalTerm').modal('show');
 $('#modalTerm').on('hide.bs.modal', function () {
window.location.replace('http://hosttraining/frontend/web/index.php?r=site%2Findex');
});
 $('.modal-result_test').html('<div class="modal-result_title">sorry, You failed the test.<br>' +
 '</div><div class="modal-result_information">This is a bad result.<br>' +
 'This test You can pass no sooner than 2 weeks.<br>' +
 'I recommend You not to waste this time for nothing and thoroughly prepared.</div><div class="modal-result_information">' +
 'Success!' +
'</div>');
 console.log("Time expired");
 } else {
 document.getElementById("m").innerHTML = Math.floor(minute/10);
 document.getElementById("mm").innerHTML = minute % 10;
 document.getElementById("s").innerHTML = Math.floor(second/10);
 document.getElementById("ss").innerHTML = second % 10;
}
}
 window.intervalID = setInterval(timer, 1000);
}
June 7th 19 at 14:40
1 answer
June 7th 19 at 14:42
Solution
It is necessary to remove the window.onload and everything will work fine

Find more questions by tags JavaScript