Description
Throttle is the act of only letting the user take an action once in a given period of time.
?
Reach for when
You want to prevent duplicate actions on things like buttons.
Code
function debounce(fn, delay) {
let timer;
return function (...args) {
clearTimeout(timer);
timer = setTimeout(() => fn.apply(this, args), delay);
};
}
If async include a noice