let speed = 0, calls = 0; setInterval(() => { speed = Math.min(10, Math.floor(score / 5)); if (++calls % (10 - speed) == 0) { // ... } }, 1000 / 60);