setInterval()

A JavaScript function that runs a callback repeatedly, roughly every given number of milliseconds, until clearInterval stops it.

In more detail

The delay is a minimum: if the thread is busy, runs happen later, and they never overlap because JavaScript runs one callback at a time. A forgotten interval keeps running and keeps everything its callback references in memory, a common source of leaks.

Related terms

Taught in

References