JavaScript clearInterval() Method

You are Here:

JavaScript clearInterval() Method

The clearInterval() method clears a timer set with the setInterval() method.

Note: To use this method, you have to hold the setInterval() method in a variable.


HTML Online Editor
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Stop Count Down</button> <p id="point"></p> <script> var count = 0; var x = document.getElementById("point"); var myInterval = setInterval(myCountDown, 1000); function myFunction(){ clearInterval(myInterval); } function myCountDown(){ count = count + 1; x.innerHTML = count; } </script> </body> </html>



Parameter Values

varRequiredSpecifies the name of the variable whose value is set to 'setInterval'.


Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in JavaScript.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author