Web APIs

setTimeout()

Try the free JavaScript compiler

Requests a delayed callback from the host. Delay is not an exact execution deadline; the returned handle is host-specific.

Formal Syntax & Structure

javascript syntaxjavascript
setTimeout(callback, delay, ...args)

Parameters & Attributes

NameTypeDescription
callbackfunctionScheduled operation.
delaynumberRequested delay in milliseconds.
argsany[]Arguments supplied to the callback.

Return Value

host-specific handle

Browser ID or host timer object.

Working Example

Example Snippetjavascript
setTimeout(() => console.log("later"), 0);console.log("now");
JavaScript Reference