Engineering Decisions · Junior · Question 2 of 12

A search box calls an API billed per request. Results should appear while the user types, but not on every keystroke. What fits?

Show the answer

Correct answer: Debounce: request after a short pause in typing

Explanation

Debounce sends one request once typing pauses, so a burst of keystrokes costs a single call while results still appear without extra action. Throttle fits continuous streams like scroll or resize, where regular updates during the activity matter, but it would bill for half-typed words. Searching on Enter is the cheapest and fits expensive searches, but it breaks the requirement to show results while typing.

Further reading

Problem with a question

Engineering Decisions · Junior · question 2

Test yourself

Take the Engineering Decisions · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz