Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ericnakagawa/d32b3a6220cda37b5c20acb29c43cc74 to your computer and use it in GitHub Desktop.
Save ericnakagawa/d32b3a6220cda37b5c20acb29c43cc74 to your computer and use it in GitHub Desktop.
SetInterval for a JS loop
var iLoop, iMain;
function loop() {
clearInterval(iLoop)
iLoop = setInterval(process, 1000);
console.log("loop()");
}
function process() {
console.log("process()")
}
iMain = setInterval(loop, 1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment