Web APIs

clearTimeout()

Try the free JavaScript compiler

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

NameTypeDescription
handlehost timer handleHandle 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);
JavaScript Reference