Skip to content

Instantly share code, notes, and snippets.

@gabri83
Created August 13, 2025 08:12
Show Gist options
  • Select an option

  • Save gabri83/a62625c14a831c18b97ffa287b07d465 to your computer and use it in GitHub Desktop.

Select an option

Save gabri83/a62625c14a831c18b97ffa287b07d465 to your computer and use it in GitHub Desktop.
Debounce Function (JavaScript) 
function debounce(fn, delay) {
let timer;
return function(...args) {
clearTimeout(timer);
timer = setTimeout(() => fn.apply(this, args), delay);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment