I have some buttons that increase the speed of an automatic sweep that I have programmed, each button increases speed a little, I have it because I do not finish a button that gradually increases the speed and another that reduces it ...
So I have it right now:
function aumentar() {
clearTimeout(t);
t = setInterval(clickbutton, 2000);
localStorage.setItem('duracion', '2000')
}
function aumentar_mas() {
clearTimeout(t);
t = setInterval(clickbutton, 1000);
localStorage.setItem('duracion', '1000')
}
function aumentar_mas_mas() {
clearTimeout(t);
t = setInterval(clickbutton, 500);
localStorage.setItem('duracion', '500')
}
I would like a function that increases the speed for example in 500 and another that would reduce it.
I tried something like that but it does not work:
n = 3000;
function mas() {
n = n - 500;
t = setInterval(clickbutton,n);
localStorage.setItem('duracion', 'n')
would anyone know how to help me?