clearInterval()

The global clearInterval() method cancels a timed, repeating action which was previously established by a call to setInterval().

Syntax

clearInterval(intervalID)

Parameters

intervalID

The identifier of the repeated action you want to cancel. This ID was returned by the corresponding call to setInterval().

It's worth noting that the pool of IDs used by setInterval() and setTimeout() are shared, which means you can technically use clearInterval() and clearTimeout() interchangeably. However, for clarity, you should avoid doing so.

Return value

undefined

Example

See the setInterval() examples.

Specifications

Specification
HTML Standard
# dom-clearinterval-dev

Browser compatibility

BCD tables only load in the browser

See also