3 ms·
Does `setTimeout` have a default value for the time?
by indubitably 12y ago
Does `setTimeout` have a default value for the time?
- eric_h 12y agosetTimeout with no timeout argument simply schedules the provided function for when the interpreter is next idle. Underscore.js wraps a similar unqualified call in _.defer (last i checked, anyway; they might now provide it with a very small number or 0 for the timeout). Edit: in both cases the result is the same in most browsers.
- ahoge 12y agoIt's clamped to 4. You can't go lower than that. There is `setImmediate` for making something run the very next cycle. However, only IE10+ supports it and the other browser vendors are against it. You can use abuse `postMessage` to get a similar effect.