DOM Window.clearInterval() Method
The clearInterval() method stops a repeating timer created with setInterval().
Description
The clearInterval() method stops a repeating action set up with setInterval(). Always keep the ID so you can stop the interval, for example when a component is removed, or it will keep running in the background.
Clearing an interval from inside its own callback is the usual way to stop after a condition is met, such as a countdown reaching zero. Passing an ID that has already been cleared, or undefined, does nothing.
In frameworks, clear intervals in the clean-up step of a component, such as React's effect clean-up function, so timers don't keep running and updating state after the component has gone.
Syntax
clearInterval(intervalID)Parameters
- intervalIDThe ID returned by
setInterval().
Return Value
None (undefined).
Example
Browser Support
The following information will show you the current browser support for the Window.clearInterval() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





