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

23 lines
610 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: Window clearInterval Method
localeTitle: Window clearInterval方法
---
## Window clearInterval方法
'clearInterval'方法用于清除使用'setInterval'方法设置的计时器。
```js
clearInterval(setInteval_ID);
```
为了能够使用'clearInterval'方法,必须使用全局变量。
```js
myID = setInterval(function, milliseconds);
```
#### 更多信息:
文档: [MDN](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/clearInterval)
关于[w3schools的](https://www.w3schools.com/jsref/met_win_clearinterval.asp)更多例子