Дебюн JS
function debounce(fn, delay) {
let timer;
return (() => {
clearTimeout(timer);
timer = setTimeout(() => fn(), delay);
})();
};
// usage
function someFn() {
console.log('Hi')
};
debounce(someFn, 1000);
shahul