Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save bidyashish/1348c921cc07d254758ea09f4d539a00 to your computer and use it in GitHub Desktop.

Select an option

Save bidyashish/1348c921cc07d254758ea09f4d539a00 to your computer and use it in GitHub Desktop.
JS: Run a function 5 times with intervals of 20 seconds
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