I recently started learning the language and ran into a problem that I cannot solve.
Here is the code:
let sec10 = 10;
obrschet()
function obrschet (){
document.getElementById('countDown').innerHTML = sec10;
sec10--
timer = setTimeout(obrschet,1000);
if (sec10<0){
clearTimeout(timer);
var sec3 = 4;
krashtable()
function krashtable(){
document.getElementById('krashTable').innerHTML = rondrandom;
if (sec3>0){
obrschet()
}
}
}
}
var randomIndex = (Math.random()+ 1)
var rounded = function(number){
return +number.toFixed(2);
}
var rondrandom = (rounded(randomIndex));
console.log(rondrandom)
I cannot create a loop of these two functions so that when counting down 10 seconds, a random number is issued, it stands for three seconds and the countdown starts again from 10 seconds and ends with a random number. If someone can help, I will be very grateful!
I recently started learning the language and ran into a problem that I cannot solve. Here is the code:
let sec10 = 10; obrschet() function obrschet (){ document.getElementById('countDown').innerHTML = sec10; sec10-- timer = setTimeout(obrschet,1000); if (sec10<0){ clearTimeout(timer); var sec3 = 4; krashtable() function krashtable(){ document.getElementById('krashTable').innerHTML = rondrandom; if (sec3>0){
}
var randomIndex = (Math.random()+ 1)
var rounded = function(number){ return +number.toFixed(2); } var rondrandom = (rounded(randomIndex)); console.log(rondrandom)
I cannot create a loop of these two functions so that when counting down 10 seconds, a random number is issued, it stands for three seconds and the countdown starts again from 10 seconds and ends with a random number. If someone can help, I will be very grateful!