Description

In JavaScript, the built-in setTimeout function lets you schedule code to run after a delay.
You can cancel a specific timeout using clearTimeout(id), but there’s no built-in way to clear all active timeouts at once.


For example, if your app starts several timers and you suddenly need to stop them all — using clearTimeout one by one is inefficient and error-prone.

In this challenge, you’ll enhance the global window object by adding a new mechanism to manage all timeouts at once.


Your goal is to make it possible to cancel every active timeout with a single function call, instead of clearing each individually.

This mimics how real-world apps manage timers safely in dashboards, testing utilities, and SDK environments.

Your Task

Write a function clearAllTimeout() that initializes a system allowing you to:

  • Schedule delayed functions using setTimeout as usual.
  • Cancel all currently active timeouts at once using a new global method clearAllTimeOut().

Once everything is set up, calling clearAllTimeOut() should prevent any pending timeout callbacks from executing.

Example

Input

clearAllTimeout();

setTimeout(() => console.log("First"), 100);
setTimeout(() => console.log("Second"), 200);

clearAllTimeOut();

Expected Output

(no logs printed)

Explanation

All timeouts that were created are cleared before they can execute, ensuring no delayed functions run.