Promise With a Timeout
Implement withTimeout(promise, ms). It settles like promise if that happens within ms. Otherwise it rejects with new Error("Timed out after <ms> ms").
When promise settles first, clear the timer: the grader counts timers left running.
Everything runs on a virtual clock, so the grader sees exactly when each promise settles.
Hints
Hint 1
Race the promise against a promise that rejects when a timer fires.
Hint 2
Keep the timer id and clear it in finally, so a fast result leaves nothing running.