⌘K
Flycodx

Debounce vs Throttle

Debounce vs Throttle

EasyFrontend0% accepted

A search box fires an API call on every keystroke and floods the server. Explain the difference between debounce and throttle, when you'd choose each, and write the logic for a debounce(fn, delay) higher-order function. Cover: what each does to the call rate, a concrete use case for each (search input vs scroll handler), and how trailing vs leading edge changes behaviour.

Approach

Debounce waits for a pause before firing once; throttle caps calls to once per interval. Search → debounce; scroll/resize → throttle.

Scenarios & Expected Answers

No example scenarios for this problem.

Sign in to continue

Create a free account to view answers and mark progress.

  • Free forever — no credit card
  • Theory Q&A with detailed answers
  • Points, streaks & leaderboards
Auto Save On