Implement clearAllTimeout in JavaScript | Facebook Interview Question
@Yomesh Gupta

JavaScriptIntermediate
1082
Do you see value in our efforts?

Devtools Tech is a free platform for Frontend Engineers. It takes a lot of time, effort, and finanical resources to keep the platform running. If you see any value in our work and would like to support us then you can do using the following options.

InternationalDomestic

setTimeout is a commonly used method in frontend development to set a timer that executes a function or specified piece of code once the timer expires.

The aim of this question is to implement a clearAllTimeout method that clears all the active timers set by setTimeout.

setTimeout(() => {console.log("One")}, 4000);
setTimeout(() => {console.log("Two")}, 5000);
setTimeout(() => {console.log("Three")}, 6000);
setTimeout(() => {console.log("Four")}, 7000);

// removes all the timers set above
clearAllTimeout();

Loading IDE...