Widely available Supported across all major browsers. Safe to use in production.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
1
12
1
1
18
1

The clearInterval() method of the Window interface cancels a timed, repeating action which was previously established by a call to Window.setInterval. If the parameter provided does not identify a previously established action, this method does nothing.

1
12
1
1
18
1
worker_support

Available in workers

3
12
3.5
4
18
5
worker_support

Available in workers

3
12
3.5
4
18
5
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)

Syntax

JAVASCRIPT
setInterval(code)
setInterval(code, delay)

setInterval(func)
setInterval(func, delay)
setInterval(func, delay, param1)
setInterval(func, delay, param1, param2)
setInterval(func, delay, param1, param2, /* …, */ paramN)

Use cases

  • Using setInterval

    The setInterval() method of the Window interface repeatedly calls a function or executes a code snippet, with a fixed time delay between each call.

Cautions

  • May not be supported in older browsers.

Implementation notes

  • Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.