[Solved-6 Solutions] Stop setInterval call in JavaScript - javascript tutorial
Problem:
Is it possible to stop setinterval call in javascript ?
Solution 1:
The setInterval() method will execute the "myTimer" function once every 1 second.
Use clearInterval() to stop the time.
Solution 2:
To start displaying current time by using toTimeString() function. We will keep display part inside a function disp(). Using setInterval method we will call disp() function in every one second ( 1000 millisecond ).
We can set a new variable and incremented by ++ every time it runs.
Solution 6:
The simple way is to use the attribute of a DOM object. If the reload is started by a start/stop button, you can use the button itself. Don’t use "scope-less" variables.