Wick editor alert function with interval continuing after stopped

Viewed 13

When running my wick editor project with a interval based timer system it will continue to call alerts even when the project has been paused. (This will not continue forever for me but will last a while) I'm curious if the is a bug with wick editor or something else. This is the code I used for the timer

    let inter = setInterval(interV,1000);
    function interV(){
        alert("This code will run every second.");
    }
1 Answers

You should clear the interval Like this:

clearInterval(inter);

Or for executing onece, just use setTimeout:

setTimeout(interV, 1000);
Related