I need to increase a number and I used setInterval(Function, time)
so I put a variable for time: time = 1000
now I need to change it so I put a function that changes it when I click a button:
function changetime() {time = time - 100;}
but it seems that you can't change the time of setInterval
while is working...
how can I do that?
I tried with a setTimeout
but the number now changes "jumping". is not regular...
I'm not sure but it seems that the "jump" changes when I change the setTimeout
time... like if the timeout is now in the setInterval
time.
Original code---_>
var time = 1000;
function interval() { setInterval(Function, time);}
function changetime() {setTimeout(interval, 10);tempo = tempo - 200;}