Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumJavaScriptdebounce and throttleSingle-choice MCQ

This throttle is meant to allow at most one call per `limit` window. What is the practical behavior difference between this implementation and a typical debounce?

function throttle(fn, limit) { let inThrottle = false; return function (...args) { if (!inThrottle) { fn.apply(this, args); inThrottle = true; setTimeout(() => (inThrottle = false), limit); } }; }