Master programming syntax, solve interactive challenges & run live code in Syntaxis Explore Arena →
Intermediate · 25 XP

Implement Debounce Function

Implement a `debounce(fn, delay)` function. The returned debounced function should delay invoking `fn` until after `delay` milliseconds have elapsed since the last time the debounced function was called.

Show Step-by-Step Hint
  • • Store a timer variable in the outer closure.
  • • Clear any existing timer on each invocation before calling setTimeout.
Type: Code Challenge
Runtime: JAVASCRIPT
JAVASCRIPT solutionCHALLENGE #3
Solutions and scores are stored in your private attempt history.Sign in to submit challenge