Ed

Debouncing delays function execution until a pause in calls. It's essential for search inputs, window resize handlers, and preventing API spam. This is a real utility you'll use!

Your Task:

  • Create a debounce(fn, delay) function
  • It should return a new function that delays calling fn
  • If called again before the delay, reset the timer
  • Use setTimeout and clearTimeout
  • Use closures to remember the timer ID
TypeScript Solution
Loading...

Submit your code to see test results