Question 10 of 10Pro Only

What are debounce and throttle in JavaScript? Implement a simple debounce function and explain when to use each technique.

Sample answer preview

## Overview Both techniques limit how often a function executes, but differently: - **Debounce**: Wait until activity stops, then execute once - **Throttle**: Execute at most once per time interval ## Debounce Delays execution until after a pause in events.

debouncethrottleperformance optimizationevent handlingsetTimeoutclosures

Unlock the full answer

Get the complete model answer, key points, common pitfalls, and access to 9+ more Full-Stack Developer interview questions.

Upgrade to Pro

Starting at $19/month • Cancel anytime