const input = document.getElementById('input'); const debounc = (func, waitTime) => { let timer; return (...args) => { clearTimeout(timer); timer = setTimeout(() => { func(...args); }, waitTime); }; } function getData(e) { console.log(e.target.value) }; const debouncApi = debounc(getData, 1000); input.addEventListener('input', debouncApi);