U
Can you write a function to debounce an input?
AI
Sure — here's a simple debounce helper:
AI
javascript
function debounce(fn, delay) {
  let timer
  return (...args) => {
    clearTimeout(timer)
    timer = setTimeout(() => fn(...args), delay)
  }
}
AI
Call it once — it waits until the user stops typing before running.

Create a free website with Framer, the website builder loved by startups, designers and agencies.