# setTimeout function

The `setTimeout` function sets the delay before code execution. Callback should be passed as the first parameter, the second - the time in milliseconds, indicating after what interval the code specified by the first parameter will start executing. The function returns a unique identifier that can be used to stop the timer. To do this, this identifier should be passed to the `clearTimeout` function.

## Syntax

`setTimeout(function, time);`

## Example

Let's output some text to the console with a delay of `1` second:

`setTimeout(function() { console.log('text'); }, 1000);`

## See also

- the `setInterval` function
  that starts a timer

← →
↑
en ru