Modern JavaScript·hard 30 min 120 XP
Implement Throttle
Return a throttled wrapper that calls fn at most once per `interval` ms, running immediately on the first call.
Examples
- const t = throttle(fn, 100); // fn runs at most once per 100ms
Constraints
- Keep the required function name so the tests can find it
- Return a value instead of only logging it
- Do not mutate inputs unless the challenge asks you to
Implement Throttle · editor
Code runs in an isolated Web Worker with a 3-second timeout — no DOM access, and it can never hang the page.