setTimeout(), setInterval(), and requestAnimationFrame()
What timing pattern does this code implement?
function debounce(fn, delay) {
let timeoutId;
return function(...args) {
clearTimeout(timeoutId);
timeoutId = setTimeout(() => fn.apply(this, args), delay);
};
}