Web APIs
clearTimeout()
Cancels a matching pending timer callback, if it has not started. An already executing callback cannot be undone.
Formal Syntax & Structure
javascript syntaxjavascript
clearTimeout(handle)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| handle | host timer handle | Handle from setTimeout. |
Return Value
undefined
No return value.
Working Example
Example Snippetjavascript
const handle = setTimeout(() => console.log("unexpected"), 0);clearTimeout(handle);setTimeout(() => console.log("kept"), 0);