A handle for a timer. You can create a timeout using setTimeout.
const timer = setTimeout(() => { console.log('Deferred work executed after 1 second'); }, 1000); console.log(`Timer scheduled: ${timer}`); const cancelled = setTimeout(() => { console.log('This will not run'); }, 5000); clearTimeout(cancelled); Copy
const timer = setTimeout(() => { console.log('Deferred work executed after 1 second'); }, 1000); console.log(`Timer scheduled: ${timer}`); const cancelled = setTimeout(() => { console.log('This will not run'); }, 5000); clearTimeout(cancelled);
Protected
Snap Hidden
Returns the name of this object's type.
Returns true if the object is of the specified type.
Returns true if this object refers to the same instance as the given object.
A handle for a timer. You can create a timeout using setTimeout.
Example