Skip to content

Instantly share code, notes, and snippets.

@rajikaimal
Last active December 24, 2018 18:58
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 rajikaimal/6cca94b1212aac61d5544aaf31af3955 to your computer and use it in GitHub Desktop.
Save rajikaimal/6cca94b1212aac61d5544aaf31af3955 to your computer and use it in GitHub Desktop.
setTimeout vs seteImmediate
setTimeout(() => {
console.log('SetTimeout callback');
}, 0);
setImmediate(() => {
console.log('SetImmediate callback');
});
// Output:
// SetImmediate callback
// SetTimeout callback
// OR
// SetTimeout callback
// SetImmediate callback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment