How to stop the execution of a function with JavaScript?

To stop the execution of a function in JavaScript, use the clearTimeout() method. This function call clears any timer set by the setTimeout() functions.

Example

You can try to run the following code to learn how to work with clearTimeout() method in JavaScript.

   
      JavaScript clearTimeout() method
      
   
   
      
                   

Click the buttons below to handle animation

                         
   
Updated on: 2020-05-21T07:45:40+05:30

9K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements