How can I repeat a function doSomething() every 5 seconds.
doSomething()
I also need code that will make it stop doing it.
And code to on-the-fly adjust the f
Use
setInterval
Calls a function repeatedly, with a fixed time delay between each call to that function.
for repeated action and
clearInterval
Cancels repeated action which was set up using setInterval().
to stop that