I am having trouble breaking out of a recursive setTimeout() and I do not know what I am doing wrong.
timer.start = function() {
//do something here
recursive(); //call the recursive once to start it up
function recursive() {
setTimeout1 = setTimeout {
function() {
//do something
recursive();//call recursive after a delay
}, delay}
}
}
How would I stop that once the "pause" button has been hit?
I have tried this:
clearTimeout(setTimeout1);
<br />
setTimeout1 = null;
This does not work all the time.