Code:
function setCoin () {
let coins = 999000;
let z = document.getElementById("coinAmount");
let t = setInterval(() => {
if (coins > 1000000) {
coins = 1000000;
clearInterval(t);
} else {
let c = Math.floor(Math.random() * 10 );
coins += c;
z.innerHTML = coins;
}
}, 10);
}
Why coins = 1000000; this line of code doesn"t work.