function debounce(func, delay) { let timeout return function (...args) { clearTimeout(timeout) timeout = setTimeout(func.bind(this, ...args), delay) } }