JavaScript Debounce Function

by john_doe 路 Mar 16, 2026 路 JavaScriptBackend Web Development
function debounce(func, delay) {
  let timeoutId;
  return function(...args) {
    clearTimeout(timeoutId);
    timeoutId = setTimeout(() => func.apply(this, args), delay);
  };
}
4.5 / 5 路 2 ratings
Login to rate.