Files
freeCodeCamp/guide/chinese/javascript/window-cleartimeout-method/index.md
2018-10-16 21:32:40 +05:30

23 lines
674 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Window clearTimeout Method
localeTitle: 窗口clearTimeout方法
---
## 窗口clearTimeout方法
'clearTimeout'方法用于停止使用'setTimeout'方法设置的计时器。
```js
clearTimeout(setTimeout_ID);
```
如果在计时器完成计数之前调用'clearTimeout'方法,'clearTimeout'方法将停止执行'setTimeout'方法。
为了能够使用'clearTimeout'方法,您必须使用全局变量。请参阅下面的示例
```js
myID = setTimeout(function, milliseconds);
```
#### 更多信息:
文档: [MDN](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/clearTimeout)