SyntaxStudy
Sign Up

Debounce Function

JAVASCRIPT Hard +50 XP
Problem Description
Write a function `debounce(fn, delay)` that returns a debounced version of `fn` — the function only executes after `delay` milliseconds have passed without it being called again.

This is a classic interview question. Describe how debounce works and implement it.

Hint: Use `setTimeout` and `clearTimeout`.
Your Solution