clearInterval() global function

Cancels the timer set by setInterval.

Syntax

clearInterval(timerId: number): void;

Parameters

timerId

The timer ID returned by setInterval. ** Passing in an ID value other than the one returned by setInterval is undefined behavior and may cause problems. **

Example

Notices

  1. setTimeout() and setInterval() have a shared pool of ID numbers, so technically clearTimeout() and clearInterval() are interchangeable. However, for clarity, you should avoid doing so.

Compatibility

Loading

Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.