Skip to content

Instantly share code, notes, and snippets.

@por
Forked from remy/gist:360113
Created November 17, 2011 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save por/1372858 to your computer and use it in GitHub Desktop.
Save por/1372858 to your computer and use it in GitHub Desktop.
setInterval run once, then keep running
setInterval((function fn () {
console.log(new Date()); // run some arbitrary code
return fn; // 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