ReborN
1
Hello there,
I have a var that generates a random value between 40 and 60.
var rand = Math.floor(Math.random() * (60 - 40 + 1) + 40);
Could someone knowledgeable assist me, I’d like to minus 1 every second from the var, until it reaches zero then stop.
Been stuck on this for too long.
Thanks for your time and assistance.
Hello!
Set an interval:
const handle = setInterval(function() {
if (rand < 0) {
clearInterval(handle);
return;
}
rand--;
}, 1000);
1 Like
ReborN
3
Thank you for the assist!
Working.
1 Like
system
Closed
4
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.