Created
August 8, 2020 13:49
-
-
Save bidyashish/1348c921cc07d254758ea09f4d539a00 to your computer and use it in GitHub Desktop.
JS: Run a function 5 times with intervals of 20 seconds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var count = 0; | |
| function myFunction() { | |
| count++; | |
| if(count > 5) clearInterval(timeout); | |
| //do something | |
| } | |
| var timeout = setInterval(myFunction, 20000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment