1

I know that setInterval is used to repeat a function several times, waiting for an interval, and setTimeout schedules an execution for the future, just one time.

To schedule an asynchronous execution, I have seen many times setTimeout(func, 0), but also setImmediate and nextTick, what is the difference? When should I use one or another

From the 4 methods, I only use frequently setTimeout, am I losing something?

greuze
  • 4,250
  • 5
  • 43
  • 62
  • 2
    This is yet another case where a *similar* question is being cited as an **exact** duplicate. The key concept that the OP appears to be missing *is not contained in the other question*. – Mark Adelsberger Mar 21 '17 at 16:06
  • 2
    To answer your question as best I can in a comment (since folks around here are bent on closing sorta-kinda-the-same questions as though they were dups): In browser use `setTimeout` (or `setInterval` if the function should run repeatedly). The other functions are for asynchronous activity in Node – Mark Adelsberger Mar 21 '17 at 16:08

0 Answers0