I'm currently experimenting with gradually decreasing the interval at which a function is executed within a setInterval method.
Below is a simplified example code snippet:
var speed = 100;
window.setInterval( speed -= 0.01 , speed);
I suspect that the value for speed is only retrieved once, during the first execution of setInterval, and then reused in subsequent executions instead of updating each time. How can I work around this potential limitation? To test this theory, I set the interval to 1000 and decreased "speed-=" by 999. Upon inspection, the value of speed dropped from 1000 to 1 initially, but subsequently continued to decrease by 999. Even when the value became negative, the functions inside setInterval continued to execute every second.