Timers

setTimeout()

Schedules a one-shot callback after a delay threshold. Timing and order are not exact guarantees.

Formal Syntax & Structure

nodejs syntaxnodejs
setTimeout(callback[, delay[, ...args]])

Parameters & Attributes

NameTypeDescription
callbackFunctionFunction to run.
delaynumberDelay in milliseconds; default 1.
argsanyCallback arguments.

Return Value

Timeout

Handle usable with clearTimeout.

Working Example

Example Snippetnodejs
setTimeout(console.log,1,'ready');
Node.js Reference