Skip to content

Instantly share code, notes, and snippets.

@xkeshav
Forked from remy/gist:360113
Created August 16, 2012 07:15
Show Gist options
  • Save xkeshav/3367635 to your computer and use it in GitHub Desktop.
Save xkeshav/3367635 to your computer and use it in GitHub Desktop.
setInterval run once, then keep running
setInterval((function () {
console.log(new Date()); // run some arbitrary code
return arguments.callee; // here be the magic
})(), 1000);
// ^---- and that runs the function, and the return val is assign to the interval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment