Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

clearTimeout(Number timeoutID)

取消由 setTimeout 设置的定时器。

参数

参数类型默认值必填说明
timeoutIDNumber是要取消的定时器的 ID

示例代码:

const timeoutID = setTimeout(function(){
    console.log('5秒后执行');
}, 5000);
//取消,以上定时器不会执行
clearTimeout(timeoutID);