setTimeout

setTimeout(function, delay) schedules a function to run after a minimum delay in milliseconds, without blocking the rest of the code. The delay is a minimum, because the function goes through the queue. clearTimeout cancels a scheduled call. setInterval repeats at a regular interval.

Example

const id = setTimeout(() => console.log('done'), 1000)
clearTimeout(id)

Related concepts

The whole glossary