const debounce = (fn, delay) => { let _timerId; return (...args) => { clearTimeout(_timerId); _timerId = setTimeout(() => { fn(...args); }, delay); }; };