# clearInterval function

The `clearInterval` function stops the timer set by the `setInterval` function. The function takes the id of the timer to stop. The timer ID is returned by the `setInterval` function.

## Syntax

`clearInterval(identifier);`

## Example

Let's start a timer that outputs integers every second, and then stop it when the counter reaches the value `10`:

`let i = 0; let id = setInterval(function() { i++; if (i == 10) { clearInterval(id); } else { console.log(i); } }, 1000);`

## See also

- the `setTimeout` function
  that sets a delay

← →
↑
en ru