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