Back to Problem Library
JavaScript Utilities

Implement Throttle

mediumJS / TS

Problem Statement

Implement a `throttle` function that creates a throttled function that only invokes `fn` at most once per every `limit` milliseconds.

Examples

Example:
const log = throttle(() => console.log('Throttled'), 1000);
log(); // Runs immediately
log(); // Ignored if called within 1000ms
Includes TypeScript & JavaScript starter code
Start Interview with this Problem