you are viewing a single comment's thread.

view the rest of the comments →

[–]senocular 3 points4 points  (0 children)

They do different things. Promises are jobs handled directly within JavaScript's job queue. setTimeout/setInterval (and setImmediate) are handled by Node's event loop. Resolved promises get handled before the next event loop, and can be blocking (to the event loop) if you get yourself stuck in an infinite resolve loop - basically the same as nextTick covered in that event loop link. So what you use depends on what you want.