Challenges • Asked 2 months ago by Ben
Working on the Implement ClearAllTimeouts challenge and I’m unsure what’s expected.
I tried two approaches:
window.clearTimeout = (id) => {
active.delete(id);
return origClearTimeout(id);
};
window.clearAllTimeouts = () => {
for (const id of active) origClearTimeout(id);
active.clear();
};
```
This seems safer and works with both numeric ids and object handles, but it does require patching.
Questions:
- Does the challenge expect the brute-force trick, or a registry-based solution?
- Should clearAll also cover setInterval, or strictly setTimeout?
- Any gotchas with Node vs browser the reviewers care about?