VOOZH about

URL: https://www.geeksforgeeks.org/javascript/how-to-stop-setinterval-call-in-javascript/

⇱ How to stop setInterval Call in JavaScript ? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to stop setInterval Call in JavaScript ?

Last Updated : 23 Jul, 2025

In JavaScript, the setInterval() function is used to repeatedly execute a specified function at a fixed interval. However, there may be scenarios where we need to stop the execution of setInterval() calls dynamically. Stopping a setInterval() call in JavaScript is essential to prevent ongoing repetitive tasks and manage resource usage efficiently.

Using clearInterval method

In this approach, we are using clearInterval the interval ID returned setInterval to directly stop the repetitive task execution at any point in your code.

Example 1: Implementation to show how to stop setInterval call in JavaScript.

Output:

👁 aaa

Example 2: Implementation to show how to stop setInterval call in JavaScript using conditional check.

Output:

👁 aaa


Example 3: Implementation to show how to stop setInterval call in JavaScript using .

Output:

👁 aaa

Comment