Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to create a debounce higher order function

const debounce = (fn, delay) => {
  let _timerId;

  return (...args) => {
    clearTimeout(_timerId);

    _timerId = setTimeout(() => {
      fn(...args);
    }, delay);
  };
};
 
PREVIOUS NEXT
Tagged: #How #create #debounce #higher #order #function
ADD COMMENT
Topic
Name
8+4 =