Create a clearAllTimeout Utility to Cancel All Pending Timers

Implement a custom clearAllTimeout() function by monkey-patching or wrapping the native setTimeout() so that every registered timer ID is tracked globally. The clearAllTimeout() call should then cancel all outstanding timers in one shot. This is useful in test cleanup, SPA route transitions, and scenarios where you need to guarantee no pending side-effects exist — a classic interview question that tests knowledge of closures and the timer API.

Examples
Input: []
Output:
Hints

Create a clearAllTimeout Utility to Cancel All Pending Timers

Implement a custom clearAllTimeout() function by monkey-patching or wrapping the native setTimeout() so that every registered timer ID is tracked globally. The clearAllTimeout() call should then cancel all outstanding timers in one shot. This is useful in test cleanup, SPA route transitions, and scenarios where you need to guarantee no pending side-effects exist — a classic interview question that tests knowledge of closures and the timer API.