freeCodeCamp/guide/english/javascript/window-clearinterval-method/index.md

23 lines
762 B
Markdown
Raw Normal View History

2018-10-12 19:37:13 +00:00
---
title: Window clearInterval Method
---
## Window clearInterval Method
The 'clearInterval()' method is used to clear a timer set with the 'setInterval()' method.
```js
clearInterval(setInteval_ID);
```
To be able to use the 'clearInterval()' method, you must use a global variable.
```js
myID = setInterval(function, milliseconds);
```
#### More Information:
<!-- Please add any articles you think might be helpful to read before writing the article -->
Documentation: <a href='https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/clearInterval' target='_blank' rel='nofollow'>MDN</a>
Some more examples on <a href='https://www.w3schools.com/jsref/met_win_clearinterval.asp' target='_blank' rel='nofollow'>w3schools</a>