0 votes
in JavaScript by
What is the difference between setTimeout, setImmediate and process.nextTick?

1 Answer

0 votes
by
  1. Set Timeout: setTimeout() is to schedule execution of a one-time callback after delay milliseconds.
  2. Set Immediate: The setImmediate function is used to execute a function right after the current event loop finishes.
  3. Process NextTick: If process.nextTick() is called in a given phase, all the callbacks passed to process.nextTick() will be resolved before the event loop continues. This will block the event loop and create I/O Starvation if process.nextTick() is called recursively.
...