Back to Problem Library
JavaScript Utilities

Implement Debounce

easyJS / TS

Problem Statement

Implement a `debounce` function that delays invoking `fn` until after `delay` milliseconds have elapsed since the last time the debounced function was invoked.

Examples

Example:
const log = debounce(() => console.log('Fired!'), 300);
log(); log(); log(); // Only prints once after 300ms of inactivity
Includes TypeScript & JavaScript starter code
Start Interview with this Problem