Question Bank

Debounce, Throttle, and Rate Limiting Quiz

Difficulty: Medium

Implement the rate-limiting primitives that ship in every UI codebase: debounce, throttle, leading-edge debounce, and `requestAnimationFrame`-paced throttling.

Question Bank
/

Debounce, Throttle, and Rate Limiting Quiz

Debounce, Throttle, and Rate Limiting Quiz

Implement the rate-limiting primitives that ship in every UI codebase: debounce, throttle, leading-edge debounce, and `requestAnimationFrame`-paced throttling.

Question Bank
Medium
JavaScript
4 questions
quiz
js-event-loop
performance-optimization
interview-prep

1,070 views

5

Implement debounce(fn, delay) so fn only runs after delay ms have passed since the last call. Preserve this and the original arguments.

Examples

Example 1:

Input: const d = debounce(console.log, 100); d('a'); d('b'); d('c');
Output: c
Explanation: Each call resets the timer, so only the final invocation's args (`'c'`) survive to fire after the quiet period.