Limit how often expensive operations run in response to frequent events.
Debouncing: Wait until events stop, then execute once.
const debouncedSearch = debounce(search, 300);
// Waits 300ms after last keystroke
Use for: Search input, window resize handlers.
Throttling: Execute at most once per interval.
const throttledScroll = throttle(onScroll, 100);
// Runs at most every 100ms
Use for: Scroll handlers, mouse move, analytics events.
Interview tip: Mention these when discussing search autocomplete or scroll-based features.